/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('rocketmq', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model DataTopicLagMapValue = {
  readyCount?: long(name='readyCount', description='Ready message count', example='1'),
  inflightCount?: long(name='inflightCount', description='The number of messages being consumed.', example='1'),
  deliveryDuration?: long(name='deliveryDuration', description='Delivery delay time, in seconds', example='12'),
  lastConsumeTimestamp?: long(name='lastConsumeTimestamp', description='lastConsumeTimestamp', example='1735629607846'),
}

model AddDisasterRecoveryItemRequest {
  topics?: [ 
    {
      consumerGroupId?: string(name='consumerGroupId', description='Consumer group ID, required for ACTIVE_ACTIVE bidirectional backup', example='GID_xxx'),
      deliveryOrderType?: string(name='deliveryOrderType', description='The order in which messages are delivered to the target instance. The parameter values ​​are as follows:
  - Concurrently: concurrent delivery
  - Orderly: sequential delivery', example='Concurrently'),
      instanceId?: string(name='instanceId', description='Instance ID, an instance ID will be automatically generated when `instanceType` is `EXTERNAL_ROCKETMQ`, and it can be obtained by querying the backup plan.', example='rmq-cn-em93y94xxx'),
      instanceType?: string(name='instanceType', description='Instance type
  - ALIYUN_ROCKETMQ: Alibaba Cloud instance
  - EXTERNAL_ROCKETMQ: External instance, open-source instance, open-source cluster', example='ALIYUN_ROCKETMQ'),
      regionId?: string(name='regionId', description='Region ID', example='cn-hangzhou'),
      topicName?: string(name='topicName', description='Disaster recovery topic name, required', example='Topic_xxx'),
    }
  ](name='topics', description='Topics included in the backup mapping. Required.'),
}

model AddDisasterRecoveryItemResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='Access denied details, only in the scenario where the user is denied access due to RAM not having permission', example='xxx'),
  code?: string(name='code', description='Error code', example='200'),
  data?: long(name='data', description='Return result, mapping task ID', example='1300000016'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='Dynamic error message', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code', example='200'),
  message?: string(name='message', description='Error message', example='xxx'),
  requestId?: string(name='requestId', description='Request ID', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Whether the operation was successful', example='true'),
}

model AddDisasterRecoveryItemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddDisasterRecoveryItemResponseBody(name='body'),
}

/**
 * @summary Add Disaster Recovery Plan Entry
 *
 * @param request AddDisasterRecoveryItemRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return AddDisasterRecoveryItemResponse
 */
async function addDisasterRecoveryItemWithOptions(planId: string, request: AddDisasterRecoveryItemRequest, headers: map[string]string, runtime: Util.RuntimeOptions): AddDisasterRecoveryItemResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.topics)) {
    body['topics'] = request.topics;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AddDisasterRecoveryItem',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/disaster_recovery/${OpenApiUtil.getEncodeParam(planId)}/items`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Add Disaster Recovery Plan Entry
 *
 * @param request AddDisasterRecoveryItemRequest
 * @return AddDisasterRecoveryItemResponse
 */
async function addDisasterRecoveryItem(planId: string, request: AddDisasterRecoveryItemRequest): AddDisasterRecoveryItemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return addDisasterRecoveryItemWithOptions(planId, request, headers, runtime);
}

model ChangeResourceGroupRequest {
  regionId?: string(name='regionId', description='The ID of the region in which the instance resides.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='resourceGroupId', description='The ID of the resource group to which the instance is changed.

You can call the [ListResourceGroups](https://www.alibabacloud.com/help/resource-management/latest/listresourcegroups) operation to query existing resource groups.

This parameter is required.', example='rg-9gLOoK****'),
  resourceId?: string(name='resourceId', description='The ID of the resource. Set this parameter to the ID of the ApsaraMQ for RocketMQ instance whose resource group you want to change.

This parameter is required.', example='c2c5d1274a8d4317a13bc5b0d4******'),
  resourceType?: string(name='resourceType', description='The type of resource.

Set this parameter to **instance**. The value of this parameter cannot be changed.

This parameter is required.', example='instance'),
}

model ChangeResourceGroupResponseBody = {
  code?: string(name='code', description='The error code returned if the call failed.', example='Instance.NotFound'),
  data?: boolean(name='data', description='The returned result.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code returned.', example='400'),
  message?: string(name='message', description='The error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The ID of the request. Each request has a unique ID. You can use this ID to troubleshoot issues.', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model ChangeResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChangeResourceGroupResponseBody(name='body'),
}

/**
 * @summary Changes the resource group to which a ApsaraMQ for RocketMQ instance belongs.
 *
 * @param request ChangeResourceGroupRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChangeResourceGroupResponse
 */
async function changeResourceGroupWithOptions(request: ChangeResourceGroupRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ChangeResourceGroupResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.regionId)) {
    query['regionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['resourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['resourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['resourceType'] = request.resourceType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ChangeResourceGroup',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/resourceGroup/change`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Changes the resource group to which a ApsaraMQ for RocketMQ instance belongs.
 *
 * @param request ChangeResourceGroupRequest
 * @return ChangeResourceGroupResponse
 */
async function changeResourceGroup(request: ChangeResourceGroupRequest): ChangeResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return changeResourceGroupWithOptions(request, headers, runtime);
}

model CreateConsumerGroupRequest {
  consumeRetryPolicy?: {
    deadLetterTargetTopic?: string(name='deadLetterTargetTopic', description='The dead-letter topic.

If a consumer still fails to consume a message after the message is retried for a specified number of times, the message is delivered to a dead-letter topic for subsequent business recovery or troubleshooting. For more information, see [Consumption retry and dead-letter messages](https://help.aliyun.com/document_detail/440356.html).', example='DLQ_mqtest'),
    maxRetryTimes?: int32(name='maxRetryTimes', description='The maximum number of retries.', example='16'),
    retryPolicy?: string(name='retryPolicy', description='The retry policy. For more information, see [Message retry](https://help.aliyun.com/document_detail/440356.html).

Valid values:

*   FixedRetryPolicy: Failed messages are retried at a fixed interval.
*   DefaultRetryPolicy: Failed messages are retried at incremental intervals as the number of retries increases.

This parameter is required.', example='DefaultRetryPolicy'),
  }(name='consumeRetryPolicy', description='consume retry policy

This parameter is required.'),
  deliveryOrderType?: string(name='deliveryOrderType', description='The dynamic error message.

This parameter is required.', example='Concurrently'),
  maxReceiveTps?: long(name='maxReceiveTps', description='Maximum received message tps', example='300'),
  remark?: string(name='remark', description='The HTTP status code.', example='This is the remark for test.'),
}

model CreateConsumerGroupResponseBody = {
  code?: string(name='code', description='The error code.', example='InvalidConsumerGroupId'),
  data?: boolean(name='data', description='The result data that is returned.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='ConsumerGroupId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='consumerGroupId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='400'),
  message?: string(name='message', description='The error message.', example='Parameter consumerGroupId is invalid.'),
  requestId?: string(name='requestId', description='The request ID.', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model CreateConsumerGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateConsumerGroupResponseBody(name='body'),
}

/**
 * @summary Creates a consumer group.
 *
 * @description The ID of the consumer group. The ID is globally unique and is used to identify a consumer group.
 * The following limits are imposed on the ID:
 * *   Character limit: The ID can contain letters, digits, underscores (_), hyphens (-), and percent signs (%).
 * *   Length limit: The ID must be 1 to 60 characters in length.
 * For more information about strings that are reserved for the system, see [Limits on parameters](https://help.aliyun.com/document_detail/440347.html).
 *
 * @param request CreateConsumerGroupRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateConsumerGroupResponse
 */
async function createConsumerGroupWithOptions(instanceId: string, consumerGroupId: string, request: CreateConsumerGroupRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateConsumerGroupResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.consumeRetryPolicy)) {
    body['consumeRetryPolicy'] = request.consumeRetryPolicy;
  }
  if (!Util.isUnset(request.deliveryOrderType)) {
    body['deliveryOrderType'] = request.deliveryOrderType;
  }
  if (!Util.isUnset(request.maxReceiveTps)) {
    body['maxReceiveTps'] = request.maxReceiveTps;
  }
  if (!Util.isUnset(request.remark)) {
    body['remark'] = request.remark;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateConsumerGroup',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/consumerGroups/${OpenApiUtil.getEncodeParam(consumerGroupId)}`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a consumer group.
 *
 * @description The ID of the consumer group. The ID is globally unique and is used to identify a consumer group.
 * The following limits are imposed on the ID:
 * *   Character limit: The ID can contain letters, digits, underscores (_), hyphens (-), and percent signs (%).
 * *   Length limit: The ID must be 1 to 60 characters in length.
 * For more information about strings that are reserved for the system, see [Limits on parameters](https://help.aliyun.com/document_detail/440347.html).
 *
 * @param request CreateConsumerGroupRequest
 * @return CreateConsumerGroupResponse
 */
async function createConsumerGroup(instanceId: string, consumerGroupId: string, request: CreateConsumerGroupRequest): CreateConsumerGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createConsumerGroupWithOptions(instanceId, consumerGroupId, request, headers, runtime);
}

model CreateDisasterRecoveryPlanRequest {
  autoSyncCheckpoint?: boolean(name='autoSyncCheckpoint', description='Whether to enable automatic synchronization of consumption progress.

> This is effective only when consumption progress synchronization is enabled, i.e., the value of `syncCheckpointEnabled` is true.', example='true'),
  instances?: [ 
    {
      authType?: string(name='authType', description='Authentication method. Not required for instanceType of ALIYUN_ROCKETMQ and version 4.0
  - NO_AUTH: No authentication required
  - ACL_AUTH: ACL authentication', example='ACL_AUTH'),
      endpointUrl?: string(name='endpointUrl', description='Endpoint URL, not required for instanceType of ALIYUN_ROCKETMQ, but required for EXTERNAL_ROCKETMQ', example='xxx'),
      instanceId?: string(name='instanceId', description='Instance ID, not required for instanceType of EXTERNAL_ROCKETMQ, but required for ALIYUN_ROCKETMQ', example='rmq-cn-******'),
      instanceRole?: string(name='instanceRole', description='Instance role, either primary or secondary
  - ACTIVE: Primary
  - PASSIVE: Secondary', example='PASSIVE'),
      instanceType?: string(name='instanceType', description='Instance type
  - ALIYUN_ROCKETMQ: Alibaba Cloud instance
  - EXTERNAL_ROCKETMQ: External instance, open-source instance, open-source cluster', example='ALIYUN_ROCKETMQ'),
      messageProperty?: {
        propertyKey?: string(name='propertyKey', description='Property key', example='aaa'),
        propertyValue?: string(name='propertyValue', description='Property value', example='bbb'),
      }(name='messageProperty', description='Message filtering properties. When messages are synchronized to the target cluster, this property will be automatically added for SQL filtering during message consumption.'),
      networkType?: string(name='networkType', description='Network type, not required for instanceType of ALIYUN_ROCKETMQ, but required for EXTERNAL_ROCKETMQ
Parameter values are as follows:
  - TCP_INTERNET: TCP public network
  - TCP_VPC: TCP VPC (Virtual Private Cloud)', example='TCP_INTERNET'),
      password?: string(name='password', description='Authentication password, required when authType is ACL_AUTH. Not required for instanceType of ALIYUN_ROCKETMQ', example='xxx'),
      regionId?: string(name='regionId', description='Region where the instance is located', example='cn-hangzhou'),
      securityGroupId?: string(name='securityGroupId', description='Security group ID, required only when the `instanceType` is EXTERNAL_ROCKETMQ and `networkType` is TCP_VPC.', example='sg-bp17hpmgz9******'),
      username?: string(name='username', description='Authentication username, required when authType is ACL_AUTH', example='xxx'),
      vSwitchId?: string(name='vSwitchId', description='The ID of the switch associated with the instance, required only when the `instanceType` is EXTERNAL_ROCKETMQ and `networkType` is TCP_VPC.', example='vsw-uf6gwtbn6etadpv******'),
      vpcId?: string(name='vpcId', description='The ID of the private network associated with the created instance. The instanceType instance type is only EXTERNAL_ROCKETMQ. It is required when the networkType is TCP_VPC.', example='vpc-wz9qt50xhtj9krb******'),
    }
  ](name='instances', description='Instances involved in the backup plan. Required'),
  planDesc?: string(name='planDesc', description='Plan description', example='xxx'),
  planName?: string(name='planName', description='Plan name, required', example='xxx'),
  planType?: string(name='planType', description='Backup plan type, required. Please refer to the [documentation](https://help.aliyun.com/document_detail/2843187.html).
Parameter values are as follows:
  - ACTIVE_PASSIVE: One-way backup
  - ACTIVE_ACTIVE: Two-way backup', example='ACTIVE_ACTIVE'),
  syncCheckpointEnabled?: boolean(name='syncCheckpointEnabled', description='Switch for synchronizing consumption progress', example='true'),
}

model CreateDisasterRecoveryPlanResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='Access denied details, provided only in scenarios where access is denied due to lack of RAM permissions', example='xxx'),
  code?: string(name='code', description='Error code', example='200'),
  data?: long(name='data', description='The result, which is the backup plan ID', example='1234'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='Dynamic error message', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code', example='200'),
  message?: string(name='message', description='Error message', example='xxx'),
  requestId?: string(name='requestId', description='Request ID', example='C7E8AE3A-219B-52EE-BE32-4036F5xxxx'),
  success?: boolean(name='success', description='Indicates whether the operation was successful', example='true'),
}

model CreateDisasterRecoveryPlanResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDisasterRecoveryPlanResponseBody(name='body'),
}

/**
 * @summary Create Disaster Recovery Plan
 *
 * @param request CreateDisasterRecoveryPlanRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDisasterRecoveryPlanResponse
 */
async function createDisasterRecoveryPlanWithOptions(request: CreateDisasterRecoveryPlanRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateDisasterRecoveryPlanResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.autoSyncCheckpoint)) {
    body['autoSyncCheckpoint'] = request.autoSyncCheckpoint;
  }
  if (!Util.isUnset(request.instances)) {
    body['instances'] = request.instances;
  }
  if (!Util.isUnset(request.planDesc)) {
    body['planDesc'] = request.planDesc;
  }
  if (!Util.isUnset(request.planName)) {
    body['planName'] = request.planName;
  }
  if (!Util.isUnset(request.planType)) {
    body['planType'] = request.planType;
  }
  if (!Util.isUnset(request.syncCheckpointEnabled)) {
    body['syncCheckpointEnabled'] = request.syncCheckpointEnabled;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateDisasterRecoveryPlan',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/disaster_recovery`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Create Disaster Recovery Plan
 *
 * @param request CreateDisasterRecoveryPlanRequest
 * @return CreateDisasterRecoveryPlanResponse
 */
async function createDisasterRecoveryPlan(request: CreateDisasterRecoveryPlanRequest): CreateDisasterRecoveryPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createDisasterRecoveryPlanWithOptions(request, headers, runtime);
}

model CreateInstanceRequest {
  autoRenew?: boolean(name='autoRenew', description='Specifies whether to enable auto-renewal for the instance. This parameter takes effect only if you set paymentType to Subscription. Valid values:

*   true
*   false', example='true'),
  autoRenewPeriod?: int32(name='autoRenewPeriod', description='The auto-renewal cycle of the instance. This parameter takes effect only if you set autoRenew to true. Unit: months.

Valid values:

*   Monthly renewal: 1, 2, 3, 6, and 12', example='3'),
  commodityCode?: string(name='commodityCode', description='The commodity code. Valid values:

*   ons_rmqpost_public_intl: pay-as-you-go
*   ons_rmqsub_public_intl: subscription
*   ons_rmqsrvlesspost_public_intl: serverless instance
serverless instance requires this parameter', example='ons_ rmqpost_public_cn'),
  instanceName?: string(name='instanceName', description='The name of the instance that you want to create.

If you leave this parameter empty, the instance ID is used as the instance name.', example='rmq-cn-72u3048uxxx'),
  networkInfo?: {
    internetInfo?: {
      flowOutBandwidth?: int32(name='flowOutBandwidth', description='The Internet bandwidth. Unit: MB/s.

This parameter is required only if you set flowOutType to payByBandwidth.

Valid values: 1 to 1000.', example='100'),
      flowOutType?: string(name='flowOutType', description='The metering method of Internet usage.

Valid values:

*   payByBandwidth: pay-by-bandwidth. This value is valid only if you enable Internet access.
*   payByTraffic: pay-by-traffic. This value is valid only if you enable Internet access.
*   uninvolved: No metering method is involved. This value is valid only if you disable Internet access.

This parameter is required.', example='uninvolved'),
      internetSpec?: string(name='internetSpec', description='Specifies whether to enable the Internet access feature.

Valid values:

*   enable
*   disable

By default, ApsaraMQ for RocketMQ allows you to access instances in VPCs. If you enable Internet access for an instance, you can access the instance over the Internet. After you enable this feature, you are charged for outbound Internet traffic. For more information, see [Internet access fees](https://help.aliyun.com/document_detail/427240.html).

This parameter is required.', example='disable'),
      ipWhitelist?: [ string ](name='ipWhitelist', description='The whitelist that includes the CIDR blocks that are allowed to access the ApsaraMQ for RocketMQ broker over the Internet. This parameter can be configured only if you use the public endpoint to access the instance.

*   If you do not configure an IP address whitelist, all CIDR blocks are allowed to access the ApsaraMQ for RocketMQ broker over the Internet.
*   If you configure an IP address whitelist, only the CIDR blocks in the whitelist are allowed to access the ApsaraMQ for RocketMQ broker over the Internet.', deprecated=true),
    }(name='internetInfo', description='The Internet-related configurations.

This parameter is required.'),
    vpcInfo?: {
      securityGroupIds?: string(name='securityGroupIds', description='The ID of the security group to which the instance belongs.', example='sg-bp17hpmgz96tvnsdy6so'),
      vSwitchId?: string(name='vSwitchId', description='The ID of the vSwitch with which the instance is associated. If you want to specify multiple vSwitches, separate the vSwitches with vertical bars (|).

>  After you create an ApsaraMQ for RocketMQ instance, you cannot change the vSwitch with which the instance is associated. If you want to change the vSwitch with which the instance is associated, you must release the instance and purchase a new instance.

>  We recommend that you configure vSwitches instead of this parameter.', example='vsw-uf6gwtbn6etadpv*******', deprecated=true),
      vSwitches?: [ 
        {
          vSwitchId?: string(name='vSwitchId', description='The ID of the vSwitch with which the instance is associated.', example='vsw-uf6gwtbn6etadpv*******'),
        }
      ](name='vSwitches', description='The vSwitches.

>  After you create an ApsaraMQ for RocketMQ instance, you cannot change the vSwitch with which the instance is associated. If you want to change the vSwitch with which the instance is associated, you must release the instance and purchase a new instance.

>  This parameter is required. We recommend that you configure this parameter instead of vSwitchId.'),
      vpcId?: string(name='vpcId', description='The ID of the VPC with which the instance to be created is associated.

>  After you create an ApsaraMQ for RocketMQ instance, you cannot change the VPC with which the instance is associated. If you want to change the VPC with which the instance is associated, you must release the instance and create a new instance.

This parameter is required.', example='vpc-wz9qt50xhtj9krb******'),
    }(name='vpcInfo', description='The virtual private cloud (VPC)-related configurations.

This parameter is required.'),
  }(name='networkInfo', description='The information about the network.

This parameter is required.'),
  paymentType?: string(name='paymentType', description='The billing method of the instance. ApsaraMQ for RocketMQ supports the subscription and pay-as-you-go billing methods.

Valid values:

*   PayAsYouGo: This billing method allows you to use resources before you pay for the resources.
*   Subscription: This billing method allows you to use resources after you pay for the resources.

For more information, see [Billing methods](https://help.aliyun.com/document_detail/427234.html).

This parameter is required.', example='Subscription'),
  period?: int32(name='period', description='The subscription duration of the instance. This parameter takes effect only if you set paymentType to Subscription.

Valid values:

*   Monthly subscription: 1, 2, 3, 4, 5, and 6
*   Yearly subscription: 1, 2, and 3', example='3'),
  periodUnit?: string(name='periodUnit', description='The unit of the subscription duration.

Valid values:

*   Month
*   Year', example='Month'),
  productInfo?: {
    autoScaling?: boolean(name='autoScaling', description='Specifies whether to enable the elastic TPS feature for the instance.

Valid values:

*   true
*   false

After you enable the elastic TPS feature for an ApsaraMQ for RocketMQ instance, you can use a specific amount of TPS that exceeds the specification limit. You are charged for the elastic TPS feature. For more information, see [Computing fees](https://help.aliyun.com/document_detail/427237.html).

>  The elastic TPS feature is supported only by instances of specific editions. For more information, see [Instance editions](https://help.aliyun.com/document_detail/444715.html).', example='true'),
    messageRetentionTime?: int32(name='messageRetentionTime', description='The retention period of messages. Unit: hours.

For information about the valid values of this parameter, see the "Limits on resource quotas" section of the [Limits](https://help.aliyun.com/document_detail/440347.html) topic.

ApsaraMQ for RocketMQ supports serverless scaling of message storage. You are charged storage fees based on your actual storage usage. You can change the retention period of messages to manage storage capacity. For more information, see [Storage fees](https://help.aliyun.com/document_detail/427238.html).', example='72'),
    msgProcessSpec?: string(name='msgProcessSpec', description='The computing specification that specifies the messaging transactions per second (TPS) of the instance. For more information, see [Instance editions](https://help.aliyun.com/document_detail/444715.html).

This parameter is required.', example='rmq.s2.2xlarge'),
    sendReceiveRatio?: float(name='sendReceiveRatio', description='The ratio of the message sending TPS to the messaging TPS of the instance.

For example, if the maximum messaging TPS of an instance is 1,000 and the ratio of the message sending TPS to the messaging TPS of the instance is 0.8, the maximum message sending TPS of the instance is 800 and the maximum message receiving TPS is 200.

Valid values: 0 to 1. Default value: 0.5.', example='0.5'),
    storageEncryption?: boolean(name='storageEncryption', description='Specifies whether to enable the encryption at rest feature.', example='false'),
    storageSecretKey?: string(name='storageSecretKey', description='The key for encryption at rest.', example='xxx'),
  }(name='productInfo', description='The information about instance specifications.'),
  remark?: string(name='remark', description='The instance description.', example='This is the remark for test.'),
  resourceGroupId?: string(name='resourceGroupId', description='The ID of the resource group to which the instance belongs.', example='rg-aekzy6pist7uuna'),
  seriesCode?: string(name='seriesCode', description='The primary edition of the instance. For information about the differences among primary edition instances, see [Instance selection](https://help.aliyun.com/document_detail/444722.html).

Valid values:

*   standard: Standard Edition
*   ultimate: Enterprise Platinum Edition
*   professional: Professional Edition

>  After you create an instance, you can only upgrade the primary edition of the instance. The following editions are sorted in ascending order: Standard Edition, Professional Edition, Enterprise Platinum Edition. For example, you can upgrade an instance from Standard Edition to Professional Edition, but you cannot downgrade an instance from Professional Edition to Standard Edition.

This parameter is required.', example='standard'),
  serviceCode?: string(name='serviceCode', description='The code of the service to which the instance belongs. The service code of ApsaraMQ for RocketMQ is rmq.

This parameter is required.', example='rmq'),
  subSeriesCode?: string(name='subSeriesCode', description='The sub-category edition of the instance. For information about the differences among sub-category edition instances, see [Instance selection](https://help.aliyun.com/document_detail/444722.html).

Valid values:

*   cluster_ha: Cluster High-availability Edition
*   single_node: Standalone Edition
*   serverless: serverless

If you set seriesCode to ultimate, you can set this parameter only to cluster_ha.

>  After you create an instance, you cannot change the sub-category edition of the instance.

Valid values:

*   serverless: serverless
*   cluster_ha: Cluster High-availability Edition
*   single_node: Standalone Edition

This parameter is required.', example='cluster_ha'),
  tags?: [ 
    {
      key?: string(name='key', description='The `key` of the tag.', example='aaa'),
      value?: string(name='value', description='The `value` of the tag.', example='bbb'),
    }
  ](name='tags', description='The tags that you want to add to the instance.'),
  clientToken?: string(name='clientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the value of this parameter, but you must ensure that the value is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.', example='c2c5d1274a8d4317a13bc5b0d4******'),
}

model CreateInstanceResponseBody = {
  code?: string(name='code', description='The error code returned if the call failed.', example='200'),
  data?: string(name='data', description='The ID of the created instance.', example='rmq-cn-7e22ody****'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code returned.', example='200'),
  message?: string(name='message', description='The error message.', example='Success'),
  requestId?: string(name='requestId', description='The ID of the request. Each request has a unique ID. You can use this ID to troubleshoot issues.', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model CreateInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateInstanceResponseBody(name='body'),
}

/**
 * @summary Creates an ApsaraMQ for RocketMQ 5.x instance.
 *
 * @description > API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
 *
 * @param request CreateInstanceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateInstanceResponse
 */
async function createInstanceWithOptions(request: CreateInstanceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateInstanceResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    query['clientToken'] = request.clientToken;
  }

  var body : map[string]any = {};
  if (!Util.isUnset(request.autoRenew)) {
    body['autoRenew'] = request.autoRenew;
  }
  if (!Util.isUnset(request.autoRenewPeriod)) {
    body['autoRenewPeriod'] = request.autoRenewPeriod;
  }
  if (!Util.isUnset(request.commodityCode)) {
    body['commodityCode'] = request.commodityCode;
  }
  if (!Util.isUnset(request.instanceName)) {
    body['instanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.networkInfo)) {
    body['networkInfo'] = request.networkInfo;
  }
  if (!Util.isUnset(request.paymentType)) {
    body['paymentType'] = request.paymentType;
  }
  if (!Util.isUnset(request.period)) {
    body['period'] = request.period;
  }
  if (!Util.isUnset(request.periodUnit)) {
    body['periodUnit'] = request.periodUnit;
  }
  if (!Util.isUnset(request.productInfo)) {
    body['productInfo'] = request.productInfo;
  }
  if (!Util.isUnset(request.remark)) {
    body['remark'] = request.remark;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['resourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.seriesCode)) {
    body['seriesCode'] = request.seriesCode;
  }
  if (!Util.isUnset(request.serviceCode)) {
    body['serviceCode'] = request.serviceCode;
  }
  if (!Util.isUnset(request.subSeriesCode)) {
    body['subSeriesCode'] = request.subSeriesCode;
  }
  if (!Util.isUnset(request.tags)) {
    body['tags'] = request.tags;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateInstance',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates an ApsaraMQ for RocketMQ 5.x instance.
 *
 * @description > API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
 *
 * @param request CreateInstanceRequest
 * @return CreateInstanceResponse
 */
async function createInstance(request: CreateInstanceRequest): CreateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createInstanceWithOptions(request, headers, runtime);
}

model CreateInstanceAccountRequest {
  password?: string(name='password', description='The password of the account.

This parameter is required.', example='xxx'),
  username?: string(name='username', description='The username of the account.

This parameter is required.', example='xxx'),
}

model CreateInstanceAccountResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='No permission details', example='xxx'),
  code?: string(name='code', description='The error code returned if the call failed.', example='MissingInstanceId'),
  data?: boolean(name='data', description='The returned result.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='InstanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The ID of the request. The system generates a unique ID for each request. You can troubleshoot issues based on the request ID.', example='3AE0999C-8DBA-5CEE-8D9A-BE8D4A90DF8D'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model CreateInstanceAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateInstanceAccountResponseBody(name='body'),
}

/**
 * @summary Creates an account that is used to access an instance.
 *
 * @param request CreateInstanceAccountRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateInstanceAccountResponse
 */
async function createInstanceAccountWithOptions(instanceId: string, request: CreateInstanceAccountRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateInstanceAccountResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.password)) {
    body['password'] = request.password;
  }
  if (!Util.isUnset(request.username)) {
    body['username'] = request.username;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateInstanceAccount',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/accounts`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates an account that is used to access an instance.
 *
 * @param request CreateInstanceAccountRequest
 * @return CreateInstanceAccountResponse
 */
async function createInstanceAccount(instanceId: string, request: CreateInstanceAccountRequest): CreateInstanceAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createInstanceAccountWithOptions(instanceId, request, headers, runtime);
}

model CreateInstanceAclRequest {
  actions?: [ string ](name='actions', description='The type of operations that can be performed on the resource.

The following types of operations are supported based on the resource type:

*   Topic: Pub, Sub, and Pub|Sub
*   Consumer group: Sub

Valid values:

*   SUB: subscribe
*   Pub|Sub: publish and subscribe
*   Pub: publish

This parameter is required.', example='Pub'),
  decision?: string(name='decision', description='The decision result of the authorization.

Valid values:

*   Deny
*   Allow

This parameter is required.', example='Allow'),
  ipWhitelists?: [ string ](name='ipWhitelists', description='The IP address whitelists.'),
  resourceName?: string(name='resourceName', description='The name of the resource on which you want to grant permissions.

This parameter is required.', example='test'),
  resourceType?: string(name='resourceType', description='The type of the resource on which you want to grant permissions.

Valid values:

*   Group
*   Topic

This parameter is required.', example='Topic'),
}

model CreateInstanceAclResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied because the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='MissingInstanceId'),
  data?: boolean(name='data', description='The returned data.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The request ID.', example='C7E8AE3A-219B-52EE-BE32-4036F5F88833'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model CreateInstanceAclResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateInstanceAclResponseBody(name='body'),
}

/**
 * @summary Creates an access control list (ACL) in a specific instance.
 *
 * @param request CreateInstanceAclRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateInstanceAclResponse
 */
async function createInstanceAclWithOptions(instanceId: string, username: string, request: CreateInstanceAclRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateInstanceAclResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.actions)) {
    body['actions'] = request.actions;
  }
  if (!Util.isUnset(request.decision)) {
    body['decision'] = request.decision;
  }
  if (!Util.isUnset(request.ipWhitelists)) {
    body['ipWhitelists'] = request.ipWhitelists;
  }
  if (!Util.isUnset(request.resourceName)) {
    body['resourceName'] = request.resourceName;
  }
  if (!Util.isUnset(request.resourceType)) {
    body['resourceType'] = request.resourceType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateInstanceAcl',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/acl/account/${OpenApiUtil.getEncodeParam(username)}`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates an access control list (ACL) in a specific instance.
 *
 * @param request CreateInstanceAclRequest
 * @return CreateInstanceAclResponse
 */
async function createInstanceAcl(instanceId: string, username: string, request: CreateInstanceAclRequest): CreateInstanceAclResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createInstanceAclWithOptions(instanceId, username, request, headers, runtime);
}

model CreateInstanceIpWhitelistRequest {
  ipWhitelists?: [ string ](name='ipWhitelists', description='The IP address whitelists.

This parameter is required.'),
}

model CreateInstanceIpWhitelistResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied because the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='MissingInstanceId'),
  data?: boolean(name='data', description='The returned data.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='InstanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='400'),
  message?: string(name='message', description='The error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The request ID.', example='A07B41BD-6DD3-5349-9E76-00303DF04BBE'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model CreateInstanceIpWhitelistResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateInstanceIpWhitelistResponseBody(name='body'),
}

/**
 * @summary Creates an IP address whitelist.
 *
 * @param request CreateInstanceIpWhitelistRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateInstanceIpWhitelistResponse
 */
async function createInstanceIpWhitelistWithOptions(instanceId: string, request: CreateInstanceIpWhitelistRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateInstanceIpWhitelistResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.ipWhitelists)) {
    body['ipWhitelists'] = request.ipWhitelists;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateInstanceIpWhitelist',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ip/whitelist`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates an IP address whitelist.
 *
 * @param request CreateInstanceIpWhitelistRequest
 * @return CreateInstanceIpWhitelistResponse
 */
async function createInstanceIpWhitelist(instanceId: string, request: CreateInstanceIpWhitelistRequest): CreateInstanceIpWhitelistResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createInstanceIpWhitelistWithOptions(instanceId, request, headers, runtime);
}

model CreateTopicRequest {
  maxSendTps?: long(name='maxSendTps', description='The maximum TPS for message sending.', example='1500'),
  messageType?: string(name='messageType', description='The type of messages in the topic that you want to create.

Valid values:

*   TRANSACTION: transactional messages
*   FIFO: ordered messages
*   DELAY: scheduled or delayed messages
*   NORMAL: normal messages

>  The type of messages in the topic must be the same as the type of messages that you want to send. For example, if you create a topic whose message type is ordered messages, you can use the topic to send and receive only ordered messages.', example='NORMAL'),
  remark?: string(name='remark', description='The description of the topic that you want to create.', example='This is the remark for test.'),
}

model CreateTopicResponseBody = {
  code?: string(name='code', description='Error code.', example='Topic.Existed'),
  data?: boolean(name='data', description='Return result.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code.', example='TopicName'),
  dynamicMessage?: string(name='dynamicMessage', description='Dynamic error message.', example='topicName'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code.', example='400'),
  message?: string(name='message', description='Error message.', example='The topic already exists.'),
  requestId?: string(name='requestId', description='Request ID, each request\\\\"s ID is unique and can be used for troubleshooting and problem localization.', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Indicates whether the execution was successful.', example='true'),
}

model CreateTopicResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateTopicResponseBody(name='body'),
}

/**
 * @summary Create Topic
 *
 * @param request CreateTopicRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateTopicResponse
 */
async function createTopicWithOptions(instanceId: string, topicName: string, request: CreateTopicRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateTopicResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.maxSendTps)) {
    body['maxSendTps'] = request.maxSendTps;
  }
  if (!Util.isUnset(request.messageType)) {
    body['messageType'] = request.messageType;
  }
  if (!Util.isUnset(request.remark)) {
    body['remark'] = request.remark;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTopic',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/topics/${OpenApiUtil.getEncodeParam(topicName)}`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Create Topic
 *
 * @param request CreateTopicRequest
 * @return CreateTopicResponse
 */
async function createTopic(instanceId: string, topicName: string, request: CreateTopicRequest): CreateTopicResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createTopicWithOptions(instanceId, topicName, request, headers, runtime);
}

model DeleteConsumerGroupResponseBody = {
  code?: string(name='code', description='The error code.', example='InvalidConsumerGroupId'),
  data?: boolean(name='data', description='The result data that is returned.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='ConsumerGroupId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='consumerGroupId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='400'),
  message?: string(name='message', description='The error message.', example='Parameter consumerGroupId is invalid.'),
  requestId?: string(name='requestId', description='The ID of the request. The system generates a unique ID for each request. You can troubleshoot issues based on the request ID.', example='C7F94090-3358-506A-97DC-34BC803C****'),
  success?: boolean(name='success', description='Indicates whether the call is successful.', example='true'),
}

model DeleteConsumerGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteConsumerGroupResponseBody(name='body'),
}

/**
 * @summary Deletes a specified consumer group.
 *
 * @description > API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
 * After you delete a consumer group, the consumer client associated with the consumer group cannot consume messages. Exercise caution when you call this operation.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteConsumerGroupResponse
 */
async function deleteConsumerGroupWithOptions(instanceId: string, consumerGroupId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteConsumerGroupResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteConsumerGroup',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/consumerGroups/${OpenApiUtil.getEncodeParam(consumerGroupId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a specified consumer group.
 *
 * @description > API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
 * After you delete a consumer group, the consumer client associated with the consumer group cannot consume messages. Exercise caution when you call this operation.
 *
 * @return DeleteConsumerGroupResponse
 */
async function deleteConsumerGroup(instanceId: string, consumerGroupId: string): DeleteConsumerGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteConsumerGroupWithOptions(instanceId, consumerGroupId, headers, runtime);
}

model DeleteConsumerGroupSubscriptionRequest {
  filterExpression?: string(name='filterExpression', description='The filter expression.

This parameter is required.', example='*'),
  filterType?: string(name='filterType', description='The type of the filter expression. Valid values:

*   SQL: filters messages by using SQL expressions.
*   TAG: filters messages by using tags.

This parameter is required.', example='TAG'),
  topicName?: string(name='topicName', description='The topic name.

This parameter is required.', example='topic_test'),
}

model DeleteConsumerGroupSubscriptionResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied because the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='200'),
  data?: boolean(name='data', description='The returned data.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The request ID.', example='723CDA5C-E25C-5EAF-9601-******'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model DeleteConsumerGroupSubscriptionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteConsumerGroupSubscriptionResponseBody(name='body'),
}

/**
 * @summary Deletes the subscriptions of a consumer group.
 *
 * @param request DeleteConsumerGroupSubscriptionRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteConsumerGroupSubscriptionResponse
 */
async function deleteConsumerGroupSubscriptionWithOptions(instanceId: string, consumerGroupId: string, request: DeleteConsumerGroupSubscriptionRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteConsumerGroupSubscriptionResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.filterExpression)) {
    query['filterExpression'] = request.filterExpression;
  }
  if (!Util.isUnset(request.filterType)) {
    query['filterType'] = request.filterType;
  }
  if (!Util.isUnset(request.topicName)) {
    query['topicName'] = request.topicName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteConsumerGroupSubscription',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/consumerGroups/${OpenApiUtil.getEncodeParam(consumerGroupId)}/subscriptions`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes the subscriptions of a consumer group.
 *
 * @param request DeleteConsumerGroupSubscriptionRequest
 * @return DeleteConsumerGroupSubscriptionResponse
 */
async function deleteConsumerGroupSubscription(instanceId: string, consumerGroupId: string, request: DeleteConsumerGroupSubscriptionRequest): DeleteConsumerGroupSubscriptionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteConsumerGroupSubscriptionWithOptions(instanceId, consumerGroupId, request, headers, runtime);
}

model DeleteDisasterRecoveryItemResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='Access denied details, only in the scenario where the user is denied access due to RAM not having permission', example='xxx'),
  code?: string(name='code', description='Error code', example='DisasterRecoveryItemStatus.Error'),
  data?: boolean(name='data', description='The return data', example='true'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='Dynamic error message', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code', example='200'),
  message?: string(name='message', description='Error message', example='The current status of the disaster recovery item does not support this operation.'),
  requestId?: string(name='requestId', description='Request ID', example='0B962390-D84B-5D44-8C11-79DFxxxx'),
  success?: boolean(name='success', description='Whether the operation was successful', example='true'),
}

model DeleteDisasterRecoveryItemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDisasterRecoveryItemResponseBody(name='body'),
}

/**
 * @summary 删除容灾计划条目
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDisasterRecoveryItemResponse
 */
async function deleteDisasterRecoveryItemWithOptions(planId: string, itemId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteDisasterRecoveryItemResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteDisasterRecoveryItem',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/disaster_recovery/${OpenApiUtil.getEncodeParam(planId)}/items/${OpenApiUtil.getEncodeParam(itemId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 删除容灾计划条目
 *
 * @return DeleteDisasterRecoveryItemResponse
 */
async function deleteDisasterRecoveryItem(planId: string, itemId: string): DeleteDisasterRecoveryItemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteDisasterRecoveryItemWithOptions(planId, itemId, headers, runtime);
}

model DeleteDisasterRecoveryPlanResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied because the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='DisasterRecoveryPlanStatus.Error'),
  data?: boolean(name='data', description='The data returned.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The response code.', example='200'),
  message?: string(name='message', description='The error message.', example='The current status of the disaster recovery plan does not support this operation.'),
  requestId?: string(name='requestId', description='The request ID.', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model DeleteDisasterRecoveryPlanResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDisasterRecoveryPlanResponseBody(name='body'),
}

/**
 * @summary Deletes a global message backup plan.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDisasterRecoveryPlanResponse
 */
async function deleteDisasterRecoveryPlanWithOptions(planId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteDisasterRecoveryPlanResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteDisasterRecoveryPlan',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/disaster_recovery/${OpenApiUtil.getEncodeParam(planId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a global message backup plan.
 *
 * @return DeleteDisasterRecoveryPlanResponse
 */
async function deleteDisasterRecoveryPlan(planId: string): DeleteDisasterRecoveryPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteDisasterRecoveryPlanWithOptions(planId, headers, runtime);
}

model DeleteInstanceResponseBody = {
  code?: string(name='code', description='The error code returned if the call failed.', example='MissingInstanceId'),
  data?: boolean(name='data', description='The returned result.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code returned.', example='400'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The ID of the request. Each request has a unique ID. You can use this ID to troubleshoot issues.', example='048242AA-BADA-5F29-B2CD-ED9FA344467F'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model DeleteInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteInstanceResponseBody(name='body'),
}

/**
 * @summary Deletes a ApsaraMQ for RocketMQ instance.
 *
 * @description > API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
 * *   After an instance is deleted, the instance cannot be restored. Exercise caution when you call this operation.
 * *   This operation is used to delete a pay-as-you-go instance. A subscription instance is automatically released after it expires. You do not need to manually delete a subscription instance.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteInstanceResponse
 */
async function deleteInstanceWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteInstance',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a ApsaraMQ for RocketMQ instance.
 *
 * @description > API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
 * *   After an instance is deleted, the instance cannot be restored. Exercise caution when you call this operation.
 * *   This operation is used to delete a pay-as-you-go instance. A subscription instance is automatically released after it expires. You do not need to manually delete a subscription instance.
 *
 * @return DeleteInstanceResponse
 */
async function deleteInstance(instanceId: string): DeleteInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteInstanceWithOptions(instanceId, headers, runtime);
}

model DeleteInstanceAccountResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied because the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='Instance.NotFound'),
  data?: boolean(name='data', description='The returned data.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='InstanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The request ID.', example='157DF7D4-53FB-58C6-BEBC-A9400E7EF68A'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model DeleteInstanceAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteInstanceAccountResponseBody(name='body'),
}

/**
 * @summary Delete access control ACL user
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteInstanceAccountResponse
 */
async function deleteInstanceAccountWithOptions(instanceId: string, username: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteInstanceAccountResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteInstanceAccount',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/accounts/${OpenApiUtil.getEncodeParam(username)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Delete access control ACL user
 *
 * @return DeleteInstanceAccountResponse
 */
async function deleteInstanceAccount(instanceId: string, username: string): DeleteInstanceAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteInstanceAccountWithOptions(instanceId, username, headers, runtime);
}

model DeleteInstanceAclRequest {
  resourceName?: string(name='resourceName', description='The name of the resource on which the permissions are granted.

This parameter is required.', example='test'),
  resourceType?: string(name='resourceType', description='The type of the resource on which the permissions are granted.

Valid values:

*   Group
*   Topic

This parameter is required.', example='Topic'),
}

model DeleteInstanceAclResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied due to the reason that the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='MissingInstanceId'),
  data?: boolean(name='data', description='The returned data.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The request ID.', example='7358418D-83BD-507A-8079-*****'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model DeleteInstanceAclResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteInstanceAclResponseBody(name='body'),
}

/**
 * @summary Deletes the permissions of a specific account of an instance.
 *
 * @param request DeleteInstanceAclRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteInstanceAclResponse
 */
async function deleteInstanceAclWithOptions(instanceId: string, username: string, request: DeleteInstanceAclRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteInstanceAclResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.resourceName)) {
    query['resourceName'] = request.resourceName;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['resourceType'] = request.resourceType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteInstanceAcl',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/acl/account/${OpenApiUtil.getEncodeParam(username)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes the permissions of a specific account of an instance.
 *
 * @param request DeleteInstanceAclRequest
 * @return DeleteInstanceAclResponse
 */
async function deleteInstanceAcl(instanceId: string, username: string, request: DeleteInstanceAclRequest): DeleteInstanceAclResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteInstanceAclWithOptions(instanceId, username, request, headers, runtime);
}

model DeleteInstanceIpWhitelistRequest {
  ipWhitelist?: string(name='ipWhitelist', description='The IP address whitelist.', example='0.0.0.0/0', deprecated=true),
  ipWhitelists?: [ string ](name='ipWhitelists', description='The IP address whitelist.'),
}

model DeleteInstanceIpWhitelistShrinkRequest {
  ipWhitelist?: string(name='ipWhitelist', description='The IP address whitelist.', example='0.0.0.0/0', deprecated=true),
  ipWhitelistsShrink?: string(name='ipWhitelists', description='The IP address whitelist.'),
}

model DeleteInstanceIpWhitelistResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied due to the reason that the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='MissingInstanceId'),
  data?: boolean(name='data', description='The returned data.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='InstanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The request ID.', example='16425867-C948-5A0C-9A24-5259727BE727'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model DeleteInstanceIpWhitelistResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteInstanceIpWhitelistResponseBody(name='body'),
}

/**
 * @summary Deletes a specific IP address whitelist from an instance.
 *
 * @param tmpReq DeleteInstanceIpWhitelistRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteInstanceIpWhitelistResponse
 */
async function deleteInstanceIpWhitelistWithOptions(instanceId: string, tmpReq: DeleteInstanceIpWhitelistRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteInstanceIpWhitelistResponse {
  Util.validateModel(tmpReq);
  var request = new DeleteInstanceIpWhitelistShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ipWhitelists)) {
    request.ipWhitelistsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ipWhitelists, 'ipWhitelists', 'simple');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.ipWhitelist)) {
    query['ipWhitelist'] = request.ipWhitelist;
  }
  if (!Util.isUnset(request.ipWhitelistsShrink)) {
    query['ipWhitelists'] = request.ipWhitelistsShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteInstanceIpWhitelist',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ip/whitelist`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a specific IP address whitelist from an instance.
 *
 * @param request DeleteInstanceIpWhitelistRequest
 * @return DeleteInstanceIpWhitelistResponse
 */
async function deleteInstanceIpWhitelist(instanceId: string, request: DeleteInstanceIpWhitelistRequest): DeleteInstanceIpWhitelistResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteInstanceIpWhitelistWithOptions(instanceId, request, headers, runtime);
}

model DeleteTopicResponseBody = {
  code?: string(name='code', description='The error code.', example='Topic.NotFound'),
  data?: boolean(name='data', description='The result data that is returned.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='TopicName'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='topicName'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='400'),
  message?: string(name='message', description='The error message.', example='The topic cannot be found.'),
  requestId?: string(name='requestId', description='The ID of the request. The system generates a unique ID for each request. You can troubleshoot issues based on the request ID.', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Indicates whether the call is successful.', example='true'),
}

model DeleteTopicResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteTopicResponseBody(name='body'),
}

/**
 * @summary Deletes a specified topic.
 *
 * @description If you delete the topic, the publishing and subscription relationships that are established based on the topic are cleared. Exercise caution when you call this operation.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteTopicResponse
 */
async function deleteTopicWithOptions(instanceId: string, topicName: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteTopicResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteTopic',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/topics/${OpenApiUtil.getEncodeParam(topicName)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a specified topic.
 *
 * @description If you delete the topic, the publishing and subscription relationships that are established based on the topic are cleared. Exercise caution when you call this operation.
 *
 * @return DeleteTopicResponse
 */
async function deleteTopic(instanceId: string, topicName: string): DeleteTopicResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteTopicWithOptions(instanceId, topicName, headers, runtime);
}

model GetConsumerGroupResponseBody = {
  code?: string(name='code', description='The error code.', example='InvalidConsumerGroupId'),
  data?: {
    consumeRetryPolicy?: {
      deadLetterTargetTopic?: string(name='deadLetterTargetTopic', description='The dead-letter topic.

If a consumer still fails to consume a message after the message is retried for a specified number of times, the message is delivered to a dead-letter topic for subsequent business recovery or troubleshooting. For more information, see [Consumption retry and dead-letter messages](https://help.aliyun.com/document_detail/440356.html).', example='DLQ_mqtest'),
      maxRetryTimes?: int32(name='maxRetryTimes', description='The maximum number of retries.', example='16'),
      retryPolicy?: string(name='retryPolicy', description='The retry policy.

Valid values:

*   FixedRetryPolicy

    <!-- -->

    :

    <!-- -->

    Failed messages are retried at a fixed interval

    <!-- -->

    .

*   DefaultRetryPolicy

    <!-- -->

    :

    <!-- -->

    Failed messages are retried at incremental intervals as the number of retries increases

    <!-- -->

    .', example='DefaultRetryPolicy'),
    }(name='consumeRetryPolicy', description='The consumption retry policy that you want to configure for the consumer group. For more information, see [Consumption retry](https://help.aliyun.com/document_detail/440356.html).'),
    consumerGroupId?: string(name='consumerGroupId', description='The ID of the consumer group.', example='CID-TEST'),
    createTime?: string(name='createTime', description='The time when the consumer group was created.', example='2022-08-01 20:05:50'),
    deliveryOrderType?: string(name='deliveryOrderType', description='The message delivery order of the consumer group.

Valid values:

*   Concurrently

    <!-- -->

    :

    <!-- -->

    concurrent delivery

    <!-- -->

*   Orderly

    <!-- -->

    :

    <!-- -->

    ordered delivery

    <!-- -->', example='Concurrently'),
    instanceId?: string(name='instanceId', description='The ID of the instance.', example='rmq-cn-7e22ody****'),
    maxReceiveTps?: long(name='maxReceiveTps', description='Maximum received message tps', example='1000'),
    regionId?: string(name='regionId', description='The ID of the region in which the instance resides.', example='cn-hangzhou'),
    remark?: string(name='remark', description='The remarks on the consumer group.', example='This is the remark for test.'),
    status?: string(name='status', description='The state of the consumer group.

Valid values:

*   RUNNING

    <!-- -->

    : The consumer group is

    <!-- -->

    running

    <!-- -->

    .

*   CREATING

    <!-- -->

    : The consumer group is

    <!-- -->

    being created

    <!-- -->

    .', example='RUNNING'),
    updateTime?: string(name='updateTime', description='The time when the consumer group was last updated.', example='2022-08-01 20:05:50'),
  }(name='data', description='The returned data.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='ConsumerGroupId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='consumerGroupId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='400'),
  message?: string(name='message', description='The error message.', example='Parameter consumerGroupId is invalid.'),
  requestId?: string(name='requestId', description='The ID of the request. The system generates a unique ID for each request. You can troubleshoot issues based on the request ID.', example='C7F94090-3358-506A-97DC-34BC803C****'),
  success?: boolean(name='success', description='Indicates whether the call is successful.', example='true'),
}

model GetConsumerGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetConsumerGroupResponseBody(name='body'),
}

/**
 * @summary Queries the details of a specified consumer group.
 *
 * @description > API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetConsumerGroupResponse
 */
async function getConsumerGroupWithOptions(instanceId: string, consumerGroupId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetConsumerGroupResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetConsumerGroup',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/consumerGroups/${OpenApiUtil.getEncodeParam(consumerGroupId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the details of a specified consumer group.
 *
 * @description > API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
 *
 * @return GetConsumerGroupResponse
 */
async function getConsumerGroup(instanceId: string, consumerGroupId: string): GetConsumerGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getConsumerGroupWithOptions(instanceId, consumerGroupId, headers, runtime);
}

model GetConsumerGroupLagRequest {
  topicName?: string(name='topicName', description='The topic name.', example='normal-topic-1'),
}

model GetConsumerGroupLagResponseBody = {
  code?: string(name='code', description='Error code', example='Topic.NotFound'),
  data?: {
    consumerGroupId?: string(name='consumerGroupId', description='Consumer Group ID', example='CID-TEST'),
    instanceId?: string(name='instanceId', description='Instance ID', example='rmq-cn-7e22ody****'),
    regionId?: string(name='regionId', description='Region ID', example='cn-hangzhou'),
    topicLagMap?: map[string]DataTopicLagMapValue(name='topicLagMap', description='Backlog for each topic'),
    totalLag?: {
      deliveryDuration?: long(name='deliveryDuration', description='Delivery delay time, in seconds', example='12'),
      inflightCount?: long(name='inflightCount', description='The number of messages being consumed.', example='1'),
      lastConsumeTimestamp?: long(name='lastConsumeTimestamp', description='Last consumption time', example='1735629607846'),
      readyCount?: long(name='readyCount', description='Ready message count', example='1'),
    }(name='totalLag', description='Total lag count'),
  }(name='data', description='The returned data.'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code', example='200'),
  message?: string(name='message', description='Error message', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The request ID.', example='F5764C40-FB8C-53AE-B95D-96AB3D0E9375'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model GetConsumerGroupLagResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetConsumerGroupLagResponseBody(name='body'),
}

/**
 * @summary Query Consumer Group Backlog Information
 *
 * @param request GetConsumerGroupLagRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetConsumerGroupLagResponse
 */
async function getConsumerGroupLagWithOptions(instanceId: string, consumerGroupId: string, request: GetConsumerGroupLagRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetConsumerGroupLagResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.topicName)) {
    query['topicName'] = request.topicName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetConsumerGroupLag',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/consumerGroups/${OpenApiUtil.getEncodeParam(consumerGroupId)}/lag`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Query Consumer Group Backlog Information
 *
 * @param request GetConsumerGroupLagRequest
 * @return GetConsumerGroupLagResponse
 */
async function getConsumerGroupLag(instanceId: string, consumerGroupId: string, request: GetConsumerGroupLagRequest): GetConsumerGroupLagResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getConsumerGroupLagWithOptions(instanceId, consumerGroupId, request, headers, runtime);
}

model GetConsumerGroupSubscriptionResponseBody = {
  code?: string(name='code', description='The error code.', example='Instance.NotFound'),
  data?: [ 
    {
      connectionDTO?: {
        clientId?: string(name='clientId', description='The client ID.', example='192.168.50.191@19908#-2093249153#1534215565#40385215750900'),
        egressIp?: string(name='egressIp', description='The public IP address of the host.', example='xx.xx.xx.xx'),
        hostname?: string(name='hostname', description='The host name.', example='nginx'),
        language?: string(name='language', description='The language used by the client.', example='zh'),
        messageModel?: string(name='messageModel', description='The consumption mode of the consumer group. Valid values:

*   BROADCASTING: broadcasting consumption
*   CLUSTERING: clustering consumption', example='BROADCASTING'),
        version?: string(name='version', description='The client version.', example='1.0.0'),
      }(name='connectionDTO', description='The connection details.'),
      subscriptionDTO?: {
        consumerGroupId?: string(name='consumerGroupId', description='The consumer group ID.', example='GID_inspector_group'),
        filterExpression?: string(name='filterExpression', description='The filter expression.', example='*'),
        filterExpressionType?: string(name='filterExpressionType', description='The type of the filter expression. Valid values:

*   SQL: filters messages by using SQL expressions.
*   TAG: filters messages by using tags.', example='UNSPECIFIED'),
        messageModel?: string(name='messageModel', description='The consumption mode of the consumer group. Valid values:

*   BROADCASTING: broadcasting consumption
*   CLUSTERING: clustering consumption', example='BROADCASTING'),
        subscriptionStatus?: string(name='subscriptionStatus', description='The subscription status. Valid values:

*   ONLINE: The consumer group is online. If the consumer group contains multiple consumers, this value is returned if at least one of the consumers is online.
*   OFFLINE: The consumer group is offline. If the consumer group contains multiple consumers, this value is returned only if all consumers are offline.', example='ONLINE'),
        topicName?: string(name='topicName', description='The topic to which the consumer group subscribes.', example='Topic_normal_inspector'),
      }(name='subscriptionDTO', description='The subscription details.'),
    }
  ](name='data', description='The data returned.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The response code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The request ID.', example='157DF7D4-53FB-58C6-BEBC-A9400E7EF68A'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model GetConsumerGroupSubscriptionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetConsumerGroupSubscriptionResponseBody(name='body'),
}

/**
 * @summary Queries the subscriptions of a consumer group.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetConsumerGroupSubscriptionResponse
 */
async function getConsumerGroupSubscriptionWithOptions(instanceId: string, consumerGroupId: string, topicName: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetConsumerGroupSubscriptionResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetConsumerGroupSubscription',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/consumerGroups/${OpenApiUtil.getEncodeParam(consumerGroupId)}/subscriptions/${OpenApiUtil.getEncodeParam(topicName)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the subscriptions of a consumer group.
 *
 * @return GetConsumerGroupSubscriptionResponse
 */
async function getConsumerGroupSubscription(instanceId: string, consumerGroupId: string, topicName: string): GetConsumerGroupSubscriptionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getConsumerGroupSubscriptionWithOptions(instanceId, consumerGroupId, topicName, headers, runtime);
}

model GetConsumerStackRequest {
  clientId?: string(name='clientId', description='The client ID.

This parameter is required.', example='172.26.76.48@Lqd7dImlp9KJ5V84'),
}

model GetConsumerStackResponseBody = {
  code?: string(name='code', description='The error code.', example='Topic.NotFound'),
  data?: {
    consumerGroupId?: string(name='consumerGroupId', description='The ID of the consumer group.', example='CID-TEST'),
    instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-7e22ody****'),
    regionId?: string(name='regionId', description='The region ID.', example='cn-hangzhou'),
    stacks?: [ 
      {
        thread?: string(name='thread', description='Thread id.', example='123'),
        tracks?: [ string ](name='tracks', description='Stack Information.'),
      }
    ](name='stacks', description='Stack Information.'),
  }(name='data', description='The data returned.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The request ID.', example='30F2CBC7-F69D-5D78-9661-0254C9E1FBFA'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model GetConsumerStackResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetConsumerStackResponseBody(name='body'),
}

/**
 * @summary Queries the stack information about a consumer.
 *
 * @param request GetConsumerStackRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetConsumerStackResponse
 */
async function getConsumerStackWithOptions(instanceId: string, consumerGroupId: string, request: GetConsumerStackRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetConsumerStackResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.clientId)) {
    query['clientId'] = request.clientId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetConsumerStack',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/consumerGroups/${OpenApiUtil.getEncodeParam(consumerGroupId)}/stack`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the stack information about a consumer.
 *
 * @param request GetConsumerStackRequest
 * @return GetConsumerStackResponse
 */
async function getConsumerStack(instanceId: string, consumerGroupId: string, request: GetConsumerStackRequest): GetConsumerStackResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getConsumerStackWithOptions(instanceId, consumerGroupId, request, headers, runtime);
}

model GetDisasterRecoveryItemResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied because the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='200'),
  data?: {
    createTime?: string(name='createTime', description='The time when the topic mapping task was created.', example='2024-06-24 02:57:31'),
    extInfo?: map[string]string(name='extInfo', description='Additional Information'),
    itemId?: long(name='itemId', description='The ID of the topic mapping', example='100070284'),
    itemStatus?: string(name='itemStatus', description='The topic mapping task status.', example='RUNNING'),
    planId?: long(name='planId', description='The ID of the global message backup plan.', example='1300000016'),
    topics?: [ 
      {
        consumerGroupId?: string(name='consumerGroupId', description='The consumer group ID.', example='xxx_reserve_group'),
        deliveryOrderType?: string(name='deliveryOrderType', description='The order in which messages are delivered to the target instance. The parameter values ​​are as follows:
  - Concurrently: concurrent delivery
  - Orderly: sequential delivery', example='Concurrently'),
        instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-wwo3xxx'),
        instanceType?: string(name='instanceType', description='Instance type
  - ALIYUN_ROCKETMQ: Alibaba Cloud instance
  - EXTERNAL_ROCKETMQ: External instance, open-source instance, open-source cluster', example='ALIYUN_ROCKETMQ'),
        regionId?: string(name='regionId', description='regionId', example='cn-hangzhou'),
        topicName?: string(name='topicName', description='The topic name.', example='order_push_xxx'),
      }
    ](name='topics', description='Topics included in the backup mapping'),
    updateTime?: string(name='updateTime', description='The time when the topic mapping task was last updated.', example='2024-09-26 02:13:10'),
  }(name='data', description='The data returned.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='xxx'),
  requestId?: string(name='requestId', description='Request ID', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model GetDisasterRecoveryItemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDisasterRecoveryItemResponseBody(name='body'),
}

/**
 * @summary 查询容灾计划条目详情
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDisasterRecoveryItemResponse
 */
async function getDisasterRecoveryItemWithOptions(planId: string, itemId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetDisasterRecoveryItemResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetDisasterRecoveryItem',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/disaster_recovery/${OpenApiUtil.getEncodeParam(planId)}/items/${OpenApiUtil.getEncodeParam(itemId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 查询容灾计划条目详情
 *
 * @return GetDisasterRecoveryItemResponse
 */
async function getDisasterRecoveryItem(planId: string, itemId: string): GetDisasterRecoveryItemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getDisasterRecoveryItemWithOptions(planId, itemId, headers, runtime);
}

model GetDisasterRecoveryPlanResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied because the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='200'),
  data?: {
    autoSyncCheckpoint?: boolean(name='autoSyncCheckpoint', description='Whether to enable automatic synchronization of consumption progress.', example='true'),
    createTime?: string(name='createTime', description='The time when the backup plan was created.', example='2022-08-01 20:05:50'),
    extInfo?: map[string]string(name='extInfo', description='Additional Information'),
    instances?: [ 
      {
        authType?: string(name='authType', description='Authentication method. Not required for instanceType of ALIYUN_ROCKETMQ and version 4.0
  - NO_AUTH: No authentication required
  - ACL_AUTH: ACL authentication', example='ACL_AUTH'),
        endpointUrl?: string(name='endpointUrl', description='Endpoint URL, not required for instanceType of ALIYUN_ROCKETMQ, but required for EXTERNAL_ROCKETMQ', example='xxx'),
        instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-gpz3qtcdxxx'),
        instanceRole?: string(name='instanceRole', description='Instance role, either primary or secondary 
  - ACTIVE: Primary
  - PASSIVE: Secondary', example='ACTIVE'),
        instanceType?: string(name='instanceType', description='Instance type
  - ALIYUN_ROCKETMQ: Alibaba Cloud instance
  - EXTERNAL_ROCKETMQ: External instance, open-source instance, open-source cluster', example='ALIYUN_ROCKETMQ'),
        messageProperty?: {
          propertyKey?: string(name='propertyKey', description='Property key', example='xxx'),
          propertyValue?: string(name='propertyValue', description='Property value', example='xxx'),
        }(name='messageProperty', description='Message filtering properties. When messages are synchronized to the target cluster, this property will be automatically added for SQL filtering during message consumption.'),
        networkType?: string(name='networkType', description='Network type, not required for instanceType of ALIYUN_ROCKETMQ, but required for EXTERNAL_ROCKETMQ Parameter values are as follows:
  - TCP_INTERNET: TCP public network
  - TCP_VPC: TCP VPC (Virtual Private Cloud)', example='TCP_INTERNET'),
        password?: string(name='password', description='Authentication password, required when authType is ACL_AUTH. Not required for instanceType of ALIYUN_ROCKETMQ', example='xxx'),
        regionId?: string(name='regionId', description='Region ID.', example='cn-shanghai'),
        securityGroupId?: string(name='securityGroupId', description='Security group ID, required only when the instanceType is EXTERNAL_ROCKETMQ and networkType is TCP_VPC.', example='sg-bp17hpmgz9******'),
        username?: string(name='username', description='Authentication username, required when authType is ACL_AUTH', example='xxx'),
        vSwitchId?: string(name='vSwitchId', description='The ID of the switch associated with the instance, required only when the instanceType is EXTERNAL_ROCKETMQ and networkType is TCP_VPC.', example='vsw-uf6gwtbn6etadpv******'),
        vpcId?: string(name='vpcId', description='The ID of the private network associated with the created instance. The instanceType instance type is only EXTERNAL_ROCKETMQ. It is required when the networkType is TCP_VPC.', example='vpc-wz9qt50xhtj9krb******'),
      }
    ](name='instances', description='Instances involved in the backup plan'),
    planDesc?: string(name='planDesc', description='The describe of the global message backup plan.', example='xxxx'),
    planId?: long(name='planId', description='The ID of the global message backup plan.', example='1300000016'),
    planName?: string(name='planName', description='The name of the global message backup plan.', example='xxx'),
    planStatus?: string(name='planStatus', description='The status of the global message backup plan.', example='RUNNING'),
    planType?: string(name='planType', description='The type of the global message backup plan.
values are as follows:
  - ACTIVE_PASSIVE: One-way backup
  - ACTIVE_ACTIVE: Two-way backup', example='ACTIVE_PASSIVE'),
    syncCheckpointEnabled?: boolean(name='syncCheckpointEnabled', description='Switch for synchronizing consumption progress', example='true'),
    updateTime?: string(name='updateTime', description='The time when the backup plan was created.', example='2022-08-01 20:05:50'),
  }(name='data', description='The data returned.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='xxx'),
  requestId?: string(name='requestId', description='The request ID.', example='7358418D-83BD-507A-8079-611C63E0xxx'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model GetDisasterRecoveryPlanResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDisasterRecoveryPlanResponseBody(name='body'),
}

/**
 * @summary 查询容灾计划详情
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDisasterRecoveryPlanResponse
 */
async function getDisasterRecoveryPlanWithOptions(planId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetDisasterRecoveryPlanResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetDisasterRecoveryPlan',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/disaster_recovery/${OpenApiUtil.getEncodeParam(planId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 查询容灾计划详情
 *
 * @return GetDisasterRecoveryPlanResponse
 */
async function getDisasterRecoveryPlan(planId: string): GetDisasterRecoveryPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getDisasterRecoveryPlanWithOptions(planId, headers, runtime);
}

model GetInstanceResponseBody = {
  code?: string(name='code', description='The error code returned if the call failed.', example='MissingInstanceId'),
  data?: {
    accountInfo?: {
      username?: string(name='username', description='The username of the instance. If you access a ApsaraMQ for RocketMQ instance over the Internet, you must configure the username and password of the instance in the SDK code for authentication.', example='6W0xz2uPfiwp****'),
    }(name='accountInfo', description='The account information.'),
    aclInfo?: {
      aclType?: string(name='aclType', description='The authentication type of the instance. This parameter is no longer in use. We recommend that you configure aclTypes.

Valid values:

- default: intelligent identity authentication

- apache_acl:access control list (ACL) identity authentication**', example='default', deprecated=true),
      aclTypes?: [ string ](name='aclTypes', description='The authentication types of the instance.'),
      defaultVpcAuthFree?: boolean(name='defaultVpcAuthFree', description='Indicates whether the authentication-free in VPCs feature is enabled.

Valid values:

*   true

    <!-- -->

    <!-- -->

    <!-- -->

*   false

    <!-- -->

    <!-- -->

    <!-- -->', example='true'),
    }(name='aclInfo', description='The information about access control.'),
    bid?: string(name='bid', description='The business ID (BID) of the commodity.', example='26842'),
    commodityCode?: string(name='commodityCode', description='The commodity code of the instance. The commodity code of a ApsaraMQ for RocketMQ 5.0 instance has a similar format as ons_rmqsub_public_cn.', example='ons_rmqsub_public_cn'),
    createTime?: string(name='createTime', description='The time when the instance was created.', example='2022-08-01 00:00:00'),
    expireTime?: string(name='expireTime', description='The time when the instance expires.', example='2022-09-01 00:00:00'),
    extConfig?: {
      aclType?: string(name='aclType', description='The authentication type of the instance.

Valid value:

*   default: intelligent authentication', example='default'),
      autoScaling?: boolean(name='autoScaling', description='Specifies whether to enable the elastic TPS feature for the instance.

Valid values:

*   true: enable
*   false: disable

This parameter is valid only when the supportAutoScaling parameter is set to enable.', example='true'),
      flowOutBandwidth?: int32(name='flowOutBandwidth', description='The Internet bandwidth. Unit: MB/s.', example='10'),
      flowOutType?: string(name='flowOutType', description='The metering method of Internet usage.

Valid values:

*   PayByTraffic: pay-by-traffic
*   paybybandwidth: pay-by-bandwidth
*   uninvolved: N/A', example='payByBandwidth'),
      internetSpec?: string(name='internetSpec', description='Indicates whether Internet access is enabled.

Valid values:

*   enable
*   disable

By default, you can access ApsaraMQ for RocketMQ instances in virtual private clouds (VPCs). If you enable the Internet access feature, you are charged for Internet outbound bandwidth. For more information, see [Internet access fees](https://help.aliyun.com/document_detail/427240.html).', example='enable'),
      messageRetentionTime?: int32(name='messageRetentionTime', description='The retention period of messages. Unit: hours.

For information about the valid values of this parameter, see the "Limits on resource quotas" section in [Usage limits](https://help.aliyun.com/document_detail/440347.html).

The storage of messages in ApsaraMQ for RocketMQ is serverless and scalable. You are charged for message storage based on your actual usage. You can change the retention period of messages to adjust storage capacity. For more information, see [Storage fee](https://help.aliyun.com/document_detail/427238.html).', example='72'),
      msgProcessSpec?: string(name='msgProcessSpec', description='The computing specification that is used to send and receive messages. For information about the upper limit of TPS, see [Instance specifications](https://help.aliyun.com/document_detail/444715.html).', example='rmq.s2.2xlarge'),
      sendReceiveRatio?: float(name='sendReceiveRatio', description='The ratio between sent messages and received messages in the instance.', example='0.5'),
      supportAutoScaling?: boolean(name='supportAutoScaling', description='Specifies whether the elastic TPS feature is supported by the instance.

Valid values:

*   true: enable
*   false: disable

After you enable the elastic TPS feature for a ApsaraMQ for RocketMQ instance, you can use a specific amount of TPS that exceeds the specification limit. You are charged for the elastic TPS feature. For more information, see [Computing fee](https://help.aliyun.com/document_detail/427237.html).

> The elastic TPS feature is supported only by specific instance editions. For more information, see [Instance specifications](https://help.aliyun.com/document_detail/444715.html).', example='true'),
    }(name='extConfig', description='The extended configurations. We recommend you configure productInfo, internetInfo, or aclInfo instead of this parameter.', deprecated=true),
    groupCount?: long(name='groupCount', description='The number of groups.', example='10'),
    instanceId?: string(name='instanceId', description='The ID of the instance', example='rmq-cn-7e22ody****'),
    instanceName?: string(name='instanceName', description='The name of the instance.', example='test instance'),
    instanceQuotas?: [ 
      {
        freeCount?: double(name='freeCount', description='The number of topics that are free of charge on the instance.', example='20'),
        quotaName?: string(name='quotaName', description='The quota name.

Valid value:

*   TOPIC_COUNT: the number of topics that can be created on the instance', example='TOPIC_COUNT'),
        totalCount?: double(name='totalCount', description='The total number of topics on the instance.', example='100'),
        usedCount?: double(name='usedCount', description='The number of used topics on the instance.', example='10'),
      }
    ](name='instanceQuotas', description='The instance quotas.'),
    networkInfo?: {
      endpoints?: [ 
        {
          endpointType?: string(name='endpointType', description='The type of the endpoint that is used to access the instance.

Valid values:

*   TCP_VPC: VPC endpoint
*   TCP_INTERNET: public endpoint', example='TCP_INTERNET'),
          endpointUrl?: string(name='endpointUrl', description='The endpoint that is used to access the instance.', example='rmq-cn-c4d2tbk****-vpc.cn-hangzhou.rmq.aliyuncs.com:8080'),
          ipWhitelist?: [ string ](name='ipWhitelist', description='The whitelist that includes the IP addresses that are allowed to access the ApsaraMQ for RocketMQ broker over the Internet. This parameter can be configured only if you use the public endpoint to access the instance.

*   If you do not configure an IP address whitelist, all CIDR blocks are allowed to access the ApsaraMQ for RocketMQ broker over the Internet.
*   If you configure an IP address whitelist, only the IP addresses in the whitelist are allowed to access the ApsaraMQ for RocketMQ broker over the Internet.

We recommend that you configure internetInfo.ipWhitelist instead of this parameter.', example='192.168.x.x/24'),
        }
      ](name='endpoints', description='The endpoints.'),
      internetInfo?: {
        flowOutBandwidth?: int32(name='flowOutBandwidth', description='The Internet bandwidth. Unit: MB/s.', example='1'),
        flowOutType?: string(name='flowOutType', description='The metering method for Internet usage.

Valid values:

*   PayByBandwidth: pay-by-bandwidth. If the Internet access feature is enabled, specify this value for the parameter.
*   uninvolved: N/A. If the Internet access feature is not enabled, specify this value for the parameter.', example='payByBandwidth'),
        internetSpec?: string(name='internetSpec', description='Specifies whether to enable the Internet access feature.

Valid values:

*   enable
*   disable

By default, ApsaraMQ for RocketMQ instances are accessed in virtual private clouds (VPCs). If you enable the Internet access feature, you are charged for Internet outbound bandwidth. For more information, see [Internet access fee](https://help.aliyun.com/document_detail/427240.html).', example='enable'),
        ipWhitelist?: [ string ](name='ipWhitelist', description='The whitelist that includes the IP addresses that are allowed to access the ApsaraMQ for RocketMQ broker.

*   If this parameter is not configured, all IP addresses are allowed to access the ApsaraMQ for RocketMQ broker over the Internet.
*   If this parameter is configured, only the IP addresses that are included in the whitelist can access the ApsaraMQ for RocketMQ broker over the Internet.'),
      }(name='internetInfo', description='The information about the Internet.'),
      vpcInfo?: {
        securityGroupIds?: string(name='securityGroupIds', description='The security group ID.', example='sg-hp35r2hc3a3sv8q2sb16'),
        vSwitchId?: string(name='vSwitchId', description='The ID of the vSwitch with which the instance is associated.', example='vsw-uf6gwtbn6etadpvz7****', deprecated=true),
        vSwitches?: [ 
          {
            vSwitchId?: string(name='vSwitchId', description='The vSwitch ID.', example='vsw-uf6gwtbn6etadpvz7****'),
            zoneId?: string(name='zoneId', description='The zone ID.', example='cn-hangzhou'),
          }
        ](name='vSwitches', description='The vSwitches.'),
        vpcId?: string(name='vpcId', description='The ID of the VPC with which the instance is associated.', example='vpc-uf6of9452b2pba82c****'),
      }(name='vpcInfo', description='The virtual private cloud (VPC) information.'),
    }(name='networkInfo', description='The network information.'),
    paymentType?: string(name='paymentType', description='The billing method of the instance.

Valid values:

*   PayAsYouGo
*   Subscription', example='Subscription'),
    productInfo?: {
      autoScaling?: boolean(name='autoScaling', description='Specifies whether to enable the elastic TPS feature for the instance.

Valid values:

*   true: enable
*   false: disable

This parameter is valid only when the supportAutoScaling parameter is set to enable.', example='true'),
      messageRetentionTime?: int32(name='messageRetentionTime', description='The retention period of messages. Unit: hours.

For information about the valid values of this parameter, see the "Limits on resource quotas" section in [Usage limits](https://help.aliyun.com/document_detail/440347.html).

The storage of messages in ApsaraMQ for RocketMQ is serverless and scalable. You are charged for message storage based on your actual usage. You can change the retention period of messages to adjust storage capacity. For more information, see [Storage fee](https://help.aliyun.com/document_detail/427238.html).', example='72'),
      msgProcessSpec?: string(name='msgProcessSpec', description='The computing specification that is used to send and receive messages. For information about the upper limit of TPS, see [Instance specifications](https://help.aliyun.com/document_detail/444715.html).', example='rmq.s2.2xlarge'),
      sendReceiveRatio?: float(name='sendReceiveRatio', description='The ratio between sent messages and received messages in the instance.', example='0.5'),
      storageEncryption?: boolean(name='storageEncryption', description='Indicates whether storage encryption is enabled.', example='false'),
      storageSecretKey?: string(name='storageSecretKey', description='The storage encryption key.', example='xxxxx'),
      supportAutoScaling?: boolean(name='supportAutoScaling', description='Specifies whether to enable the elastic TPS feature for the instance.

Valid values:

*   true: enable
*   false: disable

After you enable the elastic TPS feature for a ApsaraMQ for RocketMQ instance, you can use a specific amount of TPS that exceeds the specification limit. You are charged for the elastic TPS feature. For more information, see [Computing fee](https://help.aliyun.com/document_detail/427237.html).

> The elastic TPS feature is supported by only specific instance editions. For more information, see [Instance specifications](https://help.aliyun.com/document_detail/444715.html).', example='true'),
      traceOn?: boolean(name='traceOn', description='Indicates whether the message trace feature is enabled. Valid values:

*   true
*   false

This parameter is not in use. By default, the message trace feature is enabled for ApsaraMQ for RocketMQ instances, regardless of whether this parameter is configured.', example='true'),
    }(name='productInfo', description='The extended configurations of the instance.'),
    regionId?: string(name='regionId', description='The ID of the region in which the instance resides.', example='cn-hangzhou'),
    releaseTime?: string(name='releaseTime', description='The time when the instance was released.', example='2022-09-07 00:00:00'),
    remark?: string(name='remark', description='The description of the instance.', example='This is remark for instance.'),
    resourceGroupId?: string(name='resourceGroupId', description='The ID of the resource group.', example='rg-acfm3tmjruyribi'),
    seriesCode?: string(name='seriesCode', description='The primary edition of the instance. For information about the differences between primary edition instances, see [Instance selection](https://help.aliyun.com/document_detail/444722.html).

Valid values:

*   standard: Standard Edition
*   ultimate: Enterprise Platinum Edition
*   professional: Professional Edition', example='standard'),
    serviceCode?: string(name='serviceCode', description='The code of the service to which the instance belongs. The service code of ApsaraMQ for RocketMQ is rmq.', example='rmq'),
    software?: {
      maintainTime?: string(name='maintainTime', description='The period of upgrade time.', example='02:00-06:00'),
      softwareVersion?: string(name='softwareVersion', description='The version of software.', example='5.0-rmq-20230619-1'),
      upgradeMethod?: string(name='upgradeMethod', description='The upgrade method.

Valid values:

- Auto: automatic upgrade

- Manual: manual upgrade', example='auto'),
    }(name='software', description='The instance software information.'),
    startTime?: string(name='startTime', description='The time when the instance was started.', example='2022-08-01 00:00:00'),
    status?: string(name='status', description='The status of the instance.

Valid values:

*   RELEASED
*   RUNNING
*   STOPPED
*   CHANGING
*   CREATING', example='RUNNING'),
    subSeriesCode?: string(name='subSeriesCode', description='The sub-category edition of the instance. For information about the differences between sub-category edition instances, see [Instance selection](https://help.aliyun.com/document_detail/444722.html).

Valid values:

*   cluster_ha: Cluster High-availability Edition
*   single_node: Standalone Edition', example='cluster_ha'),
    tags?: [ 
      {
        key?: string(name='key', description='The tag key of the resource.', example='key'),
        value?: string(name='value', description='The tag value of the resource.', example='value'),
      }
    ](name='tags', description='The resource tags.'),
    topicCount?: long(name='topicCount', description='The number of topics.', example='10'),
    updateTime?: string(name='updateTime', description='The time when the instance was last modified.', example='2022-08-02 00:00:00'),
    userId?: string(name='userId', description='The ID of the user who owns the instance.', example='111111111111111'),
  }(name='data', description='The data returned.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code returned.', example='400'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The ID of the request. Each request has a unique ID. You can use this ID to troubleshoot issues.', example='05AB7FBD-F1D3-5D87-BF78-BD782249****'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model GetInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetInstanceResponseBody(name='body'),
}

/**
 * @summary Queries the detailed information about an instance.
 *
 * @description > API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetInstanceResponse
 */
async function getInstanceWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetInstance',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the detailed information about an instance.
 *
 * @description > API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
 *
 * @return GetInstanceResponse
 */
async function getInstance(instanceId: string): GetInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getInstanceWithOptions(instanceId, headers, runtime);
}

model GetInstanceAccountRequest {
  username?: string(name='username', description='The username of the account.

If you do not configure this parameter, the default username of the instance is used.', example='test'),
}

model GetInstanceAccountResponseBody = {
  code?: string(name='code', description='The error code.', example='MissingInstanceId'),
  data?: {
    accountStatus?: string(name='accountStatus', description='The status of the account.

Valid values:

*   DISABLE
*   ENABLE', example='ENABLE'),
    password?: string(name='password', description='The password of the account.', example='*************'),
    username?: string(name='username', description='The username of the account.', example='xxx'),
  }(name='data', description='The returned data.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='ConsumerGroupId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='Request ID, each request\\\\"s ID is unique and can be used for troubleshooting and problem localization.', example='B5C59E80-FCFC-5796-ABE4-D39EAAE578E4'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model GetInstanceAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetInstanceAccountResponseBody(name='body'),
}

/**
 * @summary Obtains the account used to access a specific instance.
 *
 * @param request GetInstanceAccountRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetInstanceAccountResponse
 */
async function getInstanceAccountWithOptions(instanceId: string, request: GetInstanceAccountRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetInstanceAccountResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.username)) {
    query['username'] = request.username;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetInstanceAccount',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/account`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Obtains the account used to access a specific instance.
 *
 * @param request GetInstanceAccountRequest
 * @return GetInstanceAccountResponse
 */
async function getInstanceAccount(instanceId: string, request: GetInstanceAccountRequest): GetInstanceAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getInstanceAccountWithOptions(instanceId, request, headers, runtime);
}

model GetInstanceAclRequest {
  resourceName?: string(name='resourceName', description='The name of the resource on which you want to grant permissions.

This parameter is required.', example='test'),
  resourceType?: string(name='resourceType', description='The type of the resource on which you want to grant permissions.

Valid values:

*   Group
*   Topic

This parameter is required.', example='Topic'),
}

model GetInstanceAclResponseBody = {
  code?: string(name='code', description='The error code.', example='MissingInstanceId'),
  data?: {
    aclType?: string(name='aclType', description='The authentication type of the instance.

Valid values:

*   apache_acl: open source access control list (ACL)
*   default: the default account of the instance', example='apache_acl'),
    actions?: [ string ](name='actions', description='The type of operations that can be performed on the resource.'),
    decision?: string(name='decision', description='The decision result of the authorization.', example='Allow'),
    instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-7e22ody****'),
    ipWhitelists?: [ string ](name='ipWhitelists', description='The IP address whitelists.'),
    regionId?: string(name='regionId', description='The region ID.', example='cn-hangzhou'),
    resourceName?: string(name='resourceName', description='The name of the resource on which the permissions are granted.', example='test'),
    resourceType?: string(name='resourceType', description='The type of the resource on which the permissions are granted.', example='Topic'),
    username?: string(name='username', description='The username.', example='abc'),
  }(name='data', description='The returned data.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='xxx'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='xxx'),
  httpStatusCode?: int32(name='httpStatusCode', description='The response code.', example='200'),
  message?: string(name='message', description='The error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The request ID', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model GetInstanceAclResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetInstanceAclResponseBody(name='body'),
}

/**
 * @summary Queries information about the access control list (ACL) of an instance.
 *
 * @param request GetInstanceAclRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetInstanceAclResponse
 */
async function getInstanceAclWithOptions(instanceId: string, username: string, request: GetInstanceAclRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetInstanceAclResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.resourceName)) {
    query['resourceName'] = request.resourceName;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['resourceType'] = request.resourceType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetInstanceAcl',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/acl/account/${OpenApiUtil.getEncodeParam(username)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries information about the access control list (ACL) of an instance.
 *
 * @param request GetInstanceAclRequest
 * @return GetInstanceAclResponse
 */
async function getInstanceAcl(instanceId: string, username: string, request: GetInstanceAclRequest): GetInstanceAclResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getInstanceAclWithOptions(instanceId, username, request, headers, runtime);
}

model GetInstanceIpWhitelistRequest {
  ipWhitelists?: [ string ](name='ipWhitelists', description='The  filter IP address whitelists.'),
}

model GetInstanceIpWhitelistShrinkRequest {
  ipWhitelistsShrink?: string(name='ipWhitelists', description='The  filter IP address whitelists.'),
}

model GetInstanceIpWhitelistResponseBody = {
  code?: string(name='code', description='The error code.', example='Instance.NotFound'),
  data?: {
    instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-7e22ody****'),
    ipWhitelists?: [ string ](name='ipWhitelists', description='The IP address whitelists.'),
    regionId?: string(name='regionId', description='The region ID.', example='cn-hangzhou'),
  }(name='data', description='The data returned.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='xxx'),
  requestId?: string(name='requestId', description='The request ID.', example='0B962390-D84B-5D44-8C11-79DF40299D41'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model GetInstanceIpWhitelistResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetInstanceIpWhitelistResponseBody(name='body'),
}

/**
 * @summary Queries the information about the IP address whitelist of an instance.
 *
 * @param tmpReq GetInstanceIpWhitelistRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetInstanceIpWhitelistResponse
 */
async function getInstanceIpWhitelistWithOptions(instanceId: string, tmpReq: GetInstanceIpWhitelistRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetInstanceIpWhitelistResponse {
  Util.validateModel(tmpReq);
  var request = new GetInstanceIpWhitelistShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ipWhitelists)) {
    request.ipWhitelistsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ipWhitelists, 'ipWhitelists', 'simple');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.ipWhitelistsShrink)) {
    query['ipWhitelists'] = request.ipWhitelistsShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetInstanceIpWhitelist',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ip/whitelists`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about the IP address whitelist of an instance.
 *
 * @param request GetInstanceIpWhitelistRequest
 * @return GetInstanceIpWhitelistResponse
 */
async function getInstanceIpWhitelist(instanceId: string, request: GetInstanceIpWhitelistRequest): GetInstanceIpWhitelistResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getInstanceIpWhitelistWithOptions(instanceId, request, headers, runtime);
}

model GetMessageDetailResponseBody = {
  code?: string(name='code', description='The error code.', example='Topic.NotFound'),
  data?: {
    body?: string(name='body', description='The message body.', example='{}'),
    bodySize?: int32(name='bodySize', description='The size of the message body.', example='123'),
    bornHost?: string(name='bornHost', description='The client on which the message was produced.', example='xxx.xx.xxx.xx'),
    bornTime?: string(name='bornTime', description='The time when the message was generated.', example='2023-03-22 12:17:08'),
    instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-7e22ody****'),
    messageGroup?: string(name='messageGroup', description='The sharding key. This parameter is returned only for ordered messages.', example='xx'),
    messageId?: string(name='messageId', description='The message ID.', example='01BE87E485F0C7808C04543CAF00000001'),
    messageKeys?: [ string ](name='messageKeys', description='The message keys.'),
    messageTag?: string(name='messageTag', description='The tags.', example='xx'),
    messageType?: string(name='messageType', description='The message type.', example='NORMAL'),
    regionId?: string(name='regionId', description='The region ID.', example='cn-hangzhou'),
    storeHost?: string(name='storeHost', description='The broker on which the message was stored.', example='xxx.xx.xxx.xx'),
    storeTime?: string(name='storeTime', description='The time when the message was stored.', example='2023-03-22 12:17:08'),
    systemProperties?: map[string]string(name='systemProperties', description='The default system attributes.'),
    topicName?: string(name='topicName', description='The topic name.', example='topic_test'),
    userProperties?: map[string]string(name='userProperties', description='The user attributes.'),
  }(name='data', description='The returned data.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The request ID.', example='FAEBD71F-E839-52F9-BD7B-8F1290525841'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model GetMessageDetailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetMessageDetailResponseBody(name='body'),
}

/**
 * @summary Obtains the details of a specific message.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetMessageDetailResponse
 */
async function getMessageDetailWithOptions(instanceId: string, topicName: string, messageId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetMessageDetailResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetMessageDetail',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/topics/${OpenApiUtil.getEncodeParam(topicName)}/messages/${OpenApiUtil.getEncodeParam(messageId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Obtains the details of a specific message.
 *
 * @return GetMessageDetailResponse
 */
async function getMessageDetail(instanceId: string, topicName: string, messageId: string): GetMessageDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getMessageDetailWithOptions(instanceId, topicName, messageId, headers, runtime);
}

model GetTopicResponseBody = {
  code?: string(name='code', description='Error code.', example='Topic.NotFound'),
  data?: {
    createTime?: string(name='createTime', description='Creation time of the topic.', example='2022-08-01 20:05:50'),
    instanceId?: string(name='instanceId', description='The ID of the instance to which the topic belongs.', example='rmq-cn-7e22ody****'),
    maxSendTps?: long(name='maxSendTps', description='The maximum TPS for message sending.', example='1000'),
    messageType?: string(name='messageType', description='The type of messages in the topic.

Valid values:

*   TRANSACTION: transactional messages
*   FIFO: ordered messages
*   DELAY: scheduled or delayed messages
*   NORMAL: normal messages

Valid values:

*   TRANSACTION: transactional messages
*   FIFO: ordered messages
*   DELAY: scheduled or delayed messages
*   NORMAL: normal messages', example='NORMAL'),
    regionId?: string(name='regionId', description='The region ID to which the instance belongs.', example='cn-hangzhou'),
    remark?: string(name='remark', description='Remark information of the topic.', example='This is the remark for test.'),
    status?: string(name='status', description='The topic status.

Valid values:

*   RUNNING
*   CREATING', example='RUNNING'),
    topicName?: string(name='topicName', description='Topic name.', example='topic_test'),
    updateTime?: string(name='updateTime', description='Last modification time of the topic.', example='2022-08-01 20:05:50'),
  }(name='data', description='The returned data.'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code.', example='TopicName'),
  dynamicMessage?: string(name='dynamicMessage', description='Dynamic error message.', example='topicName'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code.', example='400'),
  message?: string(name='message', description='Error message.', example='The topic cannot be found.'),
  requestId?: string(name='requestId', description='Request ID, each request\\\\"s ID is unique and can be used for troubleshooting and problem localization.', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Indicates whether the execution was successful.', example='true'),
}

model GetTopicResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTopicResponseBody(name='body'),
}

/**
 * @summary Query Topic Details
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTopicResponse
 */
async function getTopicWithOptions(instanceId: string, topicName: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTopicResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTopic',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/topics/${OpenApiUtil.getEncodeParam(topicName)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Query Topic Details
 *
 * @return GetTopicResponse
 */
async function getTopic(instanceId: string, topicName: string): GetTopicResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTopicWithOptions(instanceId, topicName, headers, runtime);
}

model GetTraceResponseBody = {
  code?: string(name='code', description='The error code.', example='InvalidConsumerGroupId'),
  data?: {
    brokerInfo?: {
      delayStatus?: string(name='delayStatus', description='Delay status.', example='SUCCESS'),
      operations?: [ 
        {
          operateTime?: string(name='operateTime', description='Operation time.', example='2023-03-22 12:17:08'),
          operateType?: string(name='operateType', description='Operation type.', example='ADD'),
        }
      ](name='operations', description='Operation list.'),
      presetDelayTime?: string(name='presetDelayTime', description='Preset delivery time.', example='2023-03-22 12:17:08'),
      recallResult?: string(name='recallResult', description='Withdraw scheduled message request result', example='RECALL_OK'),
    }(name='brokerInfo', description='The broker trace.'),
    consumerInfos?: [ 
      {
        consumeStatus?: string(name='consumeStatus', description='Consume status.', example='SUCCESS'),
        consumerGroupId?: string(name='consumerGroupId', description='The consumer group ID.', example='GID_inspector_group'),
        deadLetterInfo?: {
          messageId?: string(name='messageId', description='MessageId.', example='7F000001001F7A4F0F29463F0376047D'),
          toDlqTime?: string(name='toDlqTime', description='Arrival time in the dead letter queue.', example='2023-03-22 12:17:08'),
          topicName?: string(name='topicName', description='The topic name.', example='Register_Sync'),
        }(name='deadLetterInfo', description='Dead letter info.'),
        deadMessage?: boolean(name='deadMessage', description='Whether it is a dead letter message.', example='true'),
        records?: [ 
          {
            clientHost?: string(name='clientHost', description='Client host.', example='xx.xx.xx.xx'),
            consumeStatus?: string(name='consumeStatus', description='Consume status.', example='SUCCESS'),
            fifoEnable?: boolean(name='fifoEnable', description='Whether to consume fifo.', example='true'),
            operations?: [ 
              {
                deadMessage?: boolean(name='deadMessage', description='Whether it is a dead letter message.', example='true'),
                invisibleTime?: long(name='invisibleTime', description='Invisible time, milliseconds.', example='100'),
                operateTime?: string(name='operateTime', description='Operation time.', example='2023-03-22 12:17:08'),
                operateType?: string(name='operateType', description='Operation type.', example='ADD'),
              }
            ](name='operations', description='Operation list.'),
            popCk?: string(name='popCk', description='POP_CK', example='123'),
            userName?: string(name='userName', description='Consumer name.', example='test'),
          }
        ](name='records', description='Consumer record list.'),
      }
    ](name='consumerInfos', description='Consumer trace info.'),
    instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-7e22ody****'),
    messageInfo?: {
      body?: string(name='body', description='Message body.', example='{}'),
      bornHost?: string(name='bornHost', description='Message born host.', example='x.x.x.x'),
      bornTime?: string(name='bornTime', description='Message born time.', example='2023-03-22 12:17:08'),
      instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-u0t2ygjq505'),
      messageGroup?: string(name='messageGroup', description='Message grpup.', example='xx'),
      messageId?: string(name='messageId', description='The message ID.', example='0A79275A00207A4F0F2916C92F9A0B94'),
      messageKeys?: [ string ](name='messageKeys', description='Message keys.'),
      messageTag?: string(name='messageTag', description='Message tag.', example='xx'),
      messageType?: string(name='messageType', description='Message type.', example='NORMAL'),
      regionId?: string(name='regionId', description='The region ID.', example='cn-beijing'),
      storeHost?: string(name='storeHost', description='Message store host.', example='x.x.x.x'),
      storeTime?: string(name='storeTime', description='Message store time.', example='2023-03-22 12:17:08'),
      topicName?: string(name='topicName', description='The topic name.', example='Topic_normal_inspector'),
      transactionId?: string(name='transactionId', description='Message transaction id.', example='xx'),
      userProperties?: map[string]string(name='userProperties', description='Message user properties.'),
    }(name='messageInfo', description='The message information.'),
    producerInfo?: {
      records?: [ 
        {
          arriveTime?: string(name='arriveTime', description='Arrive time.', example='2023-03-22 12:17:08'),
          clientHost?: string(name='clientHost', description='Client host.', example='xx.xx.xx.xx'),
          dlqOriginMessageId?: string(name='dlqOriginMessageId', description='Dead-letter queue message ID.', example='0A79275A00207A4F0F2916C92F9A0B94'),
          dlqOriginTopic?: string(name='dlqOriginTopic', description='Dead-letter queue topic.', example='test_topic'),
          messageSource?: string(name='messageSource', description='Message source.', example='CONSOLE'),
          produceDuration?: long(name='produceDuration', description='Producer duration.', example='100'),
          produceStatus?: string(name='produceStatus', description='Producer status.', example='SUCCESS'),
          produceTime?: string(name='produceTime', description='Producer time.', example='2023-03-22 12:17:08'),
          recallTime?: string(name='recallTime', description='The time when the scheduled message withdrawal request was initiated', example='2023-03-22 12:17:08'),
          userName?: string(name='userName', description='Producer name.', example='xxx'),
        }
      ](name='records', description='The production records.'),
    }(name='producerInfo', description='The producer trace.'),
    regionId?: string(name='regionId', description='The region ID.', example='cn-hangzhou'),
    topicName?: string(name='topicName', description='The topic name.', example='topic_test'),
  }(name='data', description='The returned data.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The ID of the request. The system generates a unique ID for each request. You can troubleshoot issues based on the request ID.', example='7779A8FC-1BCD-5A1D-A603-C4A9BD8ADC49'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model GetTraceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTraceResponseBody(name='body'),
}

/**
 * @summary Queries the trace of a specific message in a specific topic.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTraceResponse
 */
async function getTraceWithOptions(instanceId: string, topicName: string, messageId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTraceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTrace',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/topics/${OpenApiUtil.getEncodeParam(topicName)}/traces/${OpenApiUtil.getEncodeParam(messageId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the trace of a specific message in a specific topic.
 *
 * @return GetTraceResponse
 */
async function getTrace(instanceId: string, topicName: string, messageId: string): GetTraceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTraceWithOptions(instanceId, topicName, messageId, headers, runtime);
}

model ListAvailableZonesResponseBody = {
  code?: string(name='code', description='The error code returned if the call failed.', example='Topic.NotFound'),
  data?: [ 
    {
      createTime?: string(name='createTime', description='The time when the zone was created.', example='2022-08-01 20:05:50'),
      updateTime?: string(name='updateTime', description='The time when the zone was last updated.', example='2022-08-01 20:05:50'),
      zoneId?: string(name='zoneId', description='The ID of the current zone.', example='cn-qingdao-b'),
      zoneName?: string(name='zoneName', description='The name of the current zone.', example='ha-cn-t9b30w902vm_qrs'),
    }
  ](name='data', description='The result data that is returned.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='InstanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The ID of the request. Each request has a unique ID. You can use this ID to troubleshoot issues.', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model ListAvailableZonesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAvailableZonesResponseBody(name='body'),
}

/**
 * @summary 查询支持的可用区
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAvailableZonesResponse
 */
async function listAvailableZonesWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): ListAvailableZonesResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListAvailableZones',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/zones`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 查询支持的可用区
 *
 * @return ListAvailableZonesResponse
 */
async function listAvailableZones(): ListAvailableZonesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listAvailableZonesWithOptions(headers, runtime);
}

model ListConsumerConnectionsResponseBody = {
  code?: string(name='code', description='The returned error code.', example='MissingPageNumber'),
  data?: {
    connections?: [ 
      {
        clientId?: string(name='clientId', description='The ID of the client.', example='172.17.135.197@17392#1936705963#551717232#9873695589062458'),
        egressIp?: string(name='egressIp', description='Host IP/Public IP', example='xx.xx.xx.xx'),
        hostname?: string(name='hostname', description='The `hostname` of the cloud-native box.', example='vos'),
        language?: string(name='language', description='The language of the client.', example='java'),
        messageModel?: string(name='messageModel', description='Consumption Mode
- BROADCASTING
- CLUSTERING', example='BROADCASTING'),
        version?: string(name='version', description='The version of the client.', example='1.0'),
      }
    ](name='connections', description='The client connection list'),
    consumerGroupId?: string(name='consumerGroupId', description='The consumer group ID.', example='CID-TEST'),
    instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-7e22ody****'),
    regionId?: string(name='regionId', description='The ID of the region in which the instance resides.', example='cn-hangzhou'),
  }(name='data', description='The returned data.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The ID of the request. Each request has a unique ID. You can use this ID to troubleshoot issues.', example='A3620115-6F1F-5CFB-AA3F-BBD4853B2EC4'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model ListConsumerConnectionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListConsumerConnectionsResponseBody(name='body'),
}

/**
 * @summary 查询消费者客户端连接信息
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListConsumerConnectionsResponse
 */
async function listConsumerConnectionsWithOptions(instanceId: string, consumerGroupId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListConsumerConnectionsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListConsumerConnections',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/consumerGroups/${OpenApiUtil.getEncodeParam(consumerGroupId)}/connections`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 查询消费者客户端连接信息
 *
 * @return ListConsumerConnectionsResponse
 */
async function listConsumerConnections(instanceId: string, consumerGroupId: string): ListConsumerConnectionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listConsumerConnectionsWithOptions(instanceId, consumerGroupId, headers, runtime);
}

model ListConsumerGroupSubscriptionsRequest {
  topicName?: string(name='topicName', description='The topic name. If you do not specify this parameter, all subscriptions of the consumer group are queried.', example='topic_test'),
}

model ListConsumerGroupSubscriptionsResponseBody = {
  code?: string(name='code', description='The error code.', example='MissingInstanceId'),
  data?: [ 
    {
      consistency?: boolean(name='consistency', description='Indicates whether message consumption is consistent. Valid values:

*   false: Unconsumed messages exist in the consumer group.
*   true: No unconsumed message exists in the consumer group.', example='true'),
      consumerGroupId?: string(name='consumerGroupId', description='The ID of the consumer group.', example='CID-TEST'),
      filterExpression?: string(name='filterExpression', description='The filter expression.', example='*'),
      filterExpressionType?: string(name='filterExpressionType', description='The type of the filter expression. Valid values:

*   SQL: filters messages by using SQL expressions.
*   TAG: filters messages by using tags.', example='SQL'),
      messageModel?: string(name='messageModel', description='The consumption mode of the consumer group. Valid values:

*   BROADCASTING: broadcasting consumption
*   CLUSTERING: clustering consumption', example='BROADCASTING'),
      subscriptionStatus?: string(name='subscriptionStatus', description='The subscription status. Valid values:

*   ONLINE: The consumer group is online. If the consumer group contains multiple consumers, this value is returned as long as one of the consumers is online.
*   OFFLINE: The consumer group is offline. If the consumer group contains multiple consumers, this value is returned only if all consumers are offline.', example='ONLINE'),
      topicCreated?: boolean(name='topicCreated', description='Indicates whether the topic is created.', example='true'),
      topicName?: string(name='topicName', description='The topic to which the consumer group subscribes.', example='topic_test'),
    }
  ](name='data', description='The returned data.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='InstanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The request ID.', example='5F4D9D5F-625B-59FF-BD4F-DA8284575DB4'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model ListConsumerGroupSubscriptionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListConsumerGroupSubscriptionsResponseBody(name='body'),
}

/**
 * @summary Queries the subscriptions of a specific consumer group.
 *
 * @param request ListConsumerGroupSubscriptionsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListConsumerGroupSubscriptionsResponse
 */
async function listConsumerGroupSubscriptionsWithOptions(instanceId: string, consumerGroupId: string, request: ListConsumerGroupSubscriptionsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListConsumerGroupSubscriptionsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.topicName)) {
    query['topicName'] = request.topicName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListConsumerGroupSubscriptions',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/consumerGroups/${OpenApiUtil.getEncodeParam(consumerGroupId)}/subscriptions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the subscriptions of a specific consumer group.
 *
 * @param request ListConsumerGroupSubscriptionsRequest
 * @return ListConsumerGroupSubscriptionsResponse
 */
async function listConsumerGroupSubscriptions(instanceId: string, consumerGroupId: string, request: ListConsumerGroupSubscriptionsRequest): ListConsumerGroupSubscriptionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listConsumerGroupSubscriptionsWithOptions(instanceId, consumerGroupId, request, headers, runtime);
}

model ListConsumerGroupsRequest {
  filter?: string(name='filter', description='The filter condition for the query. If not provided, all consumer groups under the specified instance will be queried.', example='CID-TEST'),
  pageNumber?: int32(name='pageNumber', description='Page number, indicating which page of results to return.', example='1'),
  pageSize?: int32(name='pageSize', description='Page size, the maximum number of results to display per page.

Value range: [10, 100].', example='10'),
}

model ListConsumerGroupsResponseBody = {
  code?: string(name='code', description='Error code.', example='MissingInstanceId'),
  data?: {
    list?: [ 
      {
        consumerGroupId?: string(name='consumerGroupId', description='Consumer group ID.', example='GID-TEST'),
        createTime?: string(name='createTime', description='Creation time of the consumer group.', example='2022-08-01 20:05:50'),
        instanceId?: string(name='instanceId', description='Instance ID.', example='rmq-cn-7e22ody****'),
        maxReceiveTps?: long(name='maxReceiveTps', description='The maximum TPS for message sending.', example='1000'),
        regionId?: string(name='regionId', description='The region ID to which the instance belongs.', example='cn-hangzhou'),
        remark?: string(name='remark', description='Remark information of the consumer group.', example='This is the remark for test.'),
        status?: string(name='status', description='Status of the consumer group.', example='RUNNING'),
        updateTime?: string(name='updateTime', description='Last update time of the consumer group.', example='2022-08-01 20:05:50'),
      }
    ](name='list', description='The consumer groups.'),
    pageNumber?: long(name='pageNumber', description='Current page number.', example='1'),
    pageSize?: long(name='pageSize', description='Page size.', example='10'),
    totalCount?: long(name='totalCount', description='Total number of returned results.', example='1'),
  }(name='data', description='The returned data.'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code.', example='xxx'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='xxx'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code.', example='400'),
  message?: string(name='message', description='Error message.', example='Parameter InstanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='Request ID, each request has a unique ID that can be used for troubleshooting and problem localization.', example='5503A460-98ED-5543-92CF-4853DE28****'),
  success?: boolean(name='success', description='Indicates whether the execution was successful.', example='true'),
}

model ListConsumerGroupsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListConsumerGroupsResponseBody(name='body'),
}

/**
 * @summary List Consumer Groups
 *
 * @description >Notice: The OpenAPI provided by Alibaba Cloud is a management API used for managing and querying related resources of Alibaba Cloud services. It is recommended to integrate it only in the management chain. Do not rely on OpenAPI implementation in the core data chain for message sending and receiving, as this may lead to risks in the chain.
 *
 * @param request ListConsumerGroupsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListConsumerGroupsResponse
 */
async function listConsumerGroupsWithOptions(instanceId: string, request: ListConsumerGroupsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListConsumerGroupsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.filter)) {
    query['filter'] = request.filter;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListConsumerGroups',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/consumerGroups`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary List Consumer Groups
 *
 * @description >Notice: The OpenAPI provided by Alibaba Cloud is a management API used for managing and querying related resources of Alibaba Cloud services. It is recommended to integrate it only in the management chain. Do not rely on OpenAPI implementation in the core data chain for message sending and receiving, as this may lead to risks in the chain.
 *
 * @param request ListConsumerGroupsRequest
 * @return ListConsumerGroupsResponse
 */
async function listConsumerGroups(instanceId: string, request: ListConsumerGroupsRequest): ListConsumerGroupsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listConsumerGroupsWithOptions(instanceId, request, headers, runtime);
}

model ListDisasterRecoveryCheckpointsRequest {
  filter?: string(name='filter', description='Filter Condition', example='topic_test'),
  instanceId?: string(name='instanceId', description='Source Instance ID

This parameter is required.', example='rmq-cn-7e22ody****'),
  pageNumber?: int32(name='pageNumber', description='Current page number, starting from 1.', example='1'),
  pageSize?: int32(name='pageSize', description='Page size, the maximum number of results returned per page.', example='10'),
}

model ListDisasterRecoveryCheckpointsResponseBody = {
  code?: string(name='code', description='Error code', example='200'),
  data?: {
    list?: [ 
      {
        checkpointId?: long(name='checkpointId', description='Consumption Progress ID', example='10000000xx'),
        itemId?: long(name='itemId', description='Backup Mapping ID', example='10000000xx'),
        lastSyncTime?: long(name='lastSyncTime', description='Last synchronization time', example='1740724080343'),
        planId?: long(name='planId', description='Backup Plan ID', example='13000000xx'),
        sourceProgress?: {
          consumerGroupId?: string(name='consumerGroupId', description='Consumer Group ID', example='GID_TEST'),
          instanceId?: string(name='instanceId', description='Instance ID', example='rmq-cn-3mp3vblzxxx'),
          instanceType?: string(name='instanceType', description='Instance type
  - ALIYUN_ROCKETMQ: Alibaba Cloud instance
  - EXTERNAL_ROCKETMQ: External instance, open-source instance, open-source cluster', example='ALIYUN_ROCKETMQ'),
          lastFetchTime?: long(name='lastFetchTime', description='Last fetch time', example='1740724080343'),
          progressData?: {
            consumeTimestamp?: long(name='consumeTimestamp', description='Latest consumption time', example='1740724080343'),
          }(name='progressData', description='Consumption progress data'),
          regionId?: string(name='regionId', description='Region ID', example='cn-hangzhou'),
          topicName?: string(name='topicName', description='The topic name.', example='TOPIC_TEST'),
        }(name='sourceProgress', description='Source consumption progress'),
        targetProgress?: {
          consumerGroupId?: string(name='consumerGroupId', description='Consumer group ID', example='GID_TEST'),
          instanceId?: string(name='instanceId', description='Instance ID', example='rmq-cn-nwy3i065xxx'),
          instanceType?: string(name='instanceType', description='Instance type
  - ALIYUN_ROCKETMQ: Alibaba Cloud instance
  - EXTERNAL_ROCKETMQ: External instance, open-source instance, open-source cluster', example='ALIYUN_ROCKETMQ'),
          lastFetchTime?: long(name='lastFetchTime', description='Latest fetch time', example='1740724080343'),
          progressData?: {
            consumeTimestamp?: long(name='consumeTimestamp', description='Latest consumption time', example='1740724080343'),
          }(name='progressData', description='Consumption progress data'),
          regionId?: string(name='regionId', description='Region ID', example='cn-hangzhou'),
          topicName?: string(name='topicName', description='Topic name', example='TOPIC_TEST'),
        }(name='targetProgress', description='Target consumption progress'),
      }
    ](name='list', description='Paged data'),
    pageNumber?: long(name='pageNumber', description='Current page number', example='1'),
    pageSize?: long(name='pageSize', description='Page size', example='10'),
    totalCount?: long(name='totalCount', description='Total number of records', example='1'),
  }(name='data', description='Response Data'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code', example='200'),
  message?: string(name='message', description='Error message', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='Request ID', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Whether the operation was successful', example='true'),
}

model ListDisasterRecoveryCheckpointsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDisasterRecoveryCheckpointsResponseBody(name='body'),
}

/**
 * @summary Query disaster recovery plan consumption progress information
 *
 * @param request ListDisasterRecoveryCheckpointsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDisasterRecoveryCheckpointsResponse
 */
async function listDisasterRecoveryCheckpointsWithOptions(planId: string, itemId: string, request: ListDisasterRecoveryCheckpointsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDisasterRecoveryCheckpointsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.filter)) {
    query['filter'] = request.filter;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['instanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDisasterRecoveryCheckpoints',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/disaster_recovery/${OpenApiUtil.getEncodeParam(planId)}/items/${OpenApiUtil.getEncodeParam(itemId)}/checkpoints`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Query disaster recovery plan consumption progress information
 *
 * @param request ListDisasterRecoveryCheckpointsRequest
 * @return ListDisasterRecoveryCheckpointsResponse
 */
async function listDisasterRecoveryCheckpoints(planId: string, itemId: string, request: ListDisasterRecoveryCheckpointsRequest): ListDisasterRecoveryCheckpointsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDisasterRecoveryCheckpointsWithOptions(planId, itemId, request, headers, runtime);
}

model ListDisasterRecoveryItemsRequest {
  filter?: string(name='filter', description='Filter condition, filter by topicName', example='topic_test'),
  pageNumber?: int32(name='pageNumber', description='Page number, indicating which page of the results to query.', example='1'),
  pageSize?: int32(name='pageSize', description='Page size, the maximum number of results displayed per page.', example='10'),
  topicName?: string(name='topicName'),
}

model ListDisasterRecoveryItemsResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='Access denied details, provided only when access is denied due to lack of RAM permissions', example='xxx'),
  code?: string(name='code', description='Error code', example='200'),
  data?: {
    list?: [ 
      {
        createTime?: string(name='createTime', description='Creation time', example='2024-09-20 03:38:28'),
        extInfo?: map[string]string(name='extInfo', description='Extended information'),
        itemId?: long(name='itemId', description='Backup plan ID', example='100070284'),
        itemStatus?: string(name='itemStatus', description='Backup mapping status:
  - CREATING (Creating)
  - CHANGING (Changing)
  - RUNNING (Running)
  - MANUAL_STOPPED (Manually Stopped)
  - OVERDUE_STOPPED (Stopped Due to Overdue)', example='RUNNING'),
        planId?: long(name='planId', description='Mapping ID', example='1300000016'),
        topics?: [ 
          {
            consumerGroupId?: string(name='consumerGroupId', description='Consumer group ID', example='group-test'),
            deliveryOrderType?: string(name='deliveryOrderType', description='The order in which messages are delivered to the target instance.

Parameter values are as follows:
- Concurrently: concurrent delivery
- Orderly: sequential delivery', example='Concurrently'),
            instanceId?: string(name='instanceId', description='Instance ID', example='rmq-cn-kh43w0olz0c'),
            instanceType?: string(name='instanceType', description='Instance type', example='ALIYUN_ROCKETMQ'),
            regionId?: string(name='regionId', description='Region ID', example='cn-hangzhou'),
            topicName?: string(name='topicName', description='The topic name.', example='topic-test'),
          }
        ](name='topics', description='Topics included in the backup mapping'),
        updateTime?: string(name='updateTime', description='Update time', example='2024-10-04 02:19:44'),
      }
    ](name='list', description='Paged data'),
    pageNumber?: long(name='pageNumber', description='Current page number', example='1'),
    pageSize?: long(name='pageSize', description='Page size', example='10'),
    scrollId?: string(name='scrollId', description='Request scroll ID.
Automatically generated by the system, subsequent pagination requests need to include this return value to continue pagination.', example='B13D0B07-F24B-4790-88D8-D47A38063D00'),
    totalCount?: long(name='totalCount', description='Total number of records', example='49'),
  }(name='data', description='Return result'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='Dynamic error message', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code', example='200'),
  message?: string(name='message', description='Error message', example='xxx'),
  requestId?: string(name='requestId', description='Request ID', example='C115601B-8736-5BBF-AC99-7FEAE12xxxx'),
  success?: boolean(name='success', description='Whether the request was successful', example='true'),
}

model ListDisasterRecoveryItemsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDisasterRecoveryItemsResponseBody(name='body'),
}

/**
 * @summary Query Disaster Recovery Plan Entry List
 *
 * @param request ListDisasterRecoveryItemsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDisasterRecoveryItemsResponse
 */
async function listDisasterRecoveryItemsWithOptions(planId: string, request: ListDisasterRecoveryItemsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDisasterRecoveryItemsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.filter)) {
    query['filter'] = request.filter;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.topicName)) {
    query['topicName'] = request.topicName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDisasterRecoveryItems',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/disaster_recovery/${OpenApiUtil.getEncodeParam(planId)}/items`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Query Disaster Recovery Plan Entry List
 *
 * @param request ListDisasterRecoveryItemsRequest
 * @return ListDisasterRecoveryItemsResponse
 */
async function listDisasterRecoveryItems(planId: string, request: ListDisasterRecoveryItemsRequest): ListDisasterRecoveryItemsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDisasterRecoveryItemsWithOptions(planId, request, headers, runtime);
}

model ListDisasterRecoveryPlansRequest {
  filter?: string(name='filter', description='Filter conditions, filter by backup name and description', example='xxx'),
  instanceId?: string(name='instanceId'),
  pageNumber?: int32(name='pageNumber', description='Page number, the page of results to be queried.', example='1'),
  pageSize?: int32(name='pageSize', description='Page size, the maximum number of results displayed per page.', example='10'),
}

model ListDisasterRecoveryPlansResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied due to the reason that the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='Error code', example='200'),
  data?: {
    list?: [ 
      {
        autoSyncCheckpoint?: boolean(name='autoSyncCheckpoint', description='Whether to enable automatic synchronization of consumption progress.', example='true'),
        createTime?: string(name='createTime', description='Creation time', example='2022-08-01 20:05:50'),
        extInfo?: map[string]string(name='extInfo', description='Extended information'),
        instances?: [ 
          {
            authType?: string(name='authType', description='Authentication method', example='NO_AUTH'),
            endpointUrl?: string(name='endpointUrl', description='Endpoint URL', example='xxx'),
            instanceId?: string(name='instanceId', description='Instance ID', example='rmq-cn-ot93rbxxx'),
            instanceRole?: string(name='instanceRole', description='Instance role', example='ACTIVE'),
            instanceType?: string(name='instanceType', description='Instance type
  - ALIYUN_ROCKETMQ: Alibaba Cloud instance
  - EXTERNAL_ROCKETMQ: External instance, open-source instance, open-source cluster', example='ALIYUN_ROCKETMQ'),
            messageProperty?: {
              propertyKey?: string(name='propertyKey', description='Property key', example='aaa'),
              propertyValue?: string(name='propertyValue', description='Property value', example='bbb'),
            }(name='messageProperty', description='Message property'),
            networkType?: string(name='networkType', description='Network type', example='TCP_INTERNET'),
            password?: string(name='password', description='Authentication password', example='xxx'),
            regionId?: string(name='regionId', description='The region where the instance is located', example='cn-hangzhou'),
            securityGroupId?: string(name='securityGroupId', description='Security group ID', example='sg-bp17hpmgz9******'),
            username?: string(name='username', description='Authentication username', example='xxx'),
            vSwitchId?: string(name='vSwitchId', description='VSwitch ID', example='vsw-uf6gwtbn6etadpv******'),
            vpcId?: string(name='vpcId', description='VPC ID', example='vpc-bp13docqysrgxtbxxxx'),
          }
        ](name='instances', description='Instances involved in the backup plan'),
        planDesc?: string(name='planDesc', description='Plan description', example='xxx'),
        planId?: long(name='planId', description='Plan ID', example='1300000016'),
        planName?: string(name='planName', description='Plan name', example='xxx'),
        planStatus?: string(name='planStatus', description='Plan status:
  - CREATED (Created)
  - RUNNING (Running)
  - DELETED (Deleted)', example='RUNNING'),
        planType?: string(name='planType', description='Plan type:
  - ACTIVE_PASSIVE (One-way backup)
  - ACTIVE_ACTIVE (Two-way backup)', example='ACTIVE_PASSIVE'),
        syncCheckpointEnabled?: boolean(name='syncCheckpointEnabled', description='Sync checkpoint switch', example='true'),
        updateTime?: string(name='updateTime', description='Update time', example='2022-08-01 20:05:50'),
      }
    ](name='list', description='Paged data'),
    pageNumber?: long(name='pageNumber', description='Current page number', example='1'),
    pageSize?: long(name='pageSize', description='Page size', example='10'),
    scrollId?: string(name='scrollId', description='Scroll request ID.
Automatically generated by the system, subsequent paging requests need to include this result to continue paging.', example='B13D0B07-F24B-4790-88D8-D47A38063D00'),
    totalCount?: long(name='totalCount', description='Total number of records', example='28'),
  }(name='data', description='Return result'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='Dynamic error message', example='InstanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code', example='200'),
  message?: string(name='message', description='Error message', example='xxx'),
  requestId?: string(name='requestId', description='Request ID', example='855EF8E6-9C1D-5DE2-9E84-924E13Exxxx'),
  success?: boolean(name='success', description='Whether the operation was successful', example='True'),
}

model ListDisasterRecoveryPlansResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDisasterRecoveryPlansResponseBody(name='body'),
}

/**
 * @summary Query Disaster Recovery Plan List
 *
 * @param request ListDisasterRecoveryPlansRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDisasterRecoveryPlansResponse
 */
async function listDisasterRecoveryPlansWithOptions(request: ListDisasterRecoveryPlansRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDisasterRecoveryPlansResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.filter)) {
    query['filter'] = request.filter;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['instanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDisasterRecoveryPlans',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/disaster_recovery`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Query Disaster Recovery Plan List
 *
 * @param request ListDisasterRecoveryPlansRequest
 * @return ListDisasterRecoveryPlansResponse
 */
async function listDisasterRecoveryPlans(request: ListDisasterRecoveryPlansRequest): ListDisasterRecoveryPlansResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDisasterRecoveryPlansWithOptions(request, headers, runtime);
}

model ListInstanceAccountRequest {
  accountStatus?: string(name='accountStatus', description='The status of the account.

Valid values:

*   DISABLE
*   ENABLE', example='ENABLE'),
  accountType?: string(name='accountType', description='The account type.
  - CUSTOMER
  - DEFAULT', example='CUSTOMER'),
  pageNumber?: int32(name='pageNumber', description='The page number. Default value: 1.', example='1'),
  pageSize?: int32(name='pageSize', description='The number of entries per page. Default value: 10.', example='10'),
  username?: string(name='username', description='The username of the account.', example='test'),
}

model ListInstanceAccountResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied because the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='MissingInstanceId'),
  data?: {
    list?: [ 
      {
        accountStatus?: string(name='accountStatus', description='The status of the account.
Valid values:
  - DISABLE
  - ENABLE', example='ENABLE'),
        accountType?: string(name='accountType', description='The account type.
  - CUSTOMER
  - DEFAULT', example='CUSTOMER'),
        instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-7e22ody****'),
        regionId?: string(name='regionId', description='The region ID.', example='cn-hangzhou'),
        username?: string(name='username', description='The username of the account.', example='test'),
      }
    ](name='list', description='The pagination information.'),
    pageNumber?: long(name='pageNumber', description='The page number.', example='1'),
    pageSize?: long(name='pageSize', description='Number of items per page.', example='10'),
    totalCount?: long(name='totalCount', description='The total number of returned entries.', example='24'),
  }(name='data', description='The data returned.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The ID of the request. Each request has a unique ID. You can use this ID to troubleshoot issues.', example='C115601B-8736-5BBF-AC99-7FEAE1245A80'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model ListInstanceAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstanceAccountResponseBody(name='body'),
}

/**
 * @summary Queries the accounts that are used to access a specific instance.
 *
 * @param request ListInstanceAccountRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstanceAccountResponse
 */
async function listInstanceAccountWithOptions(instanceId: string, request: ListInstanceAccountRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListInstanceAccountResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.accountStatus)) {
    query['accountStatus'] = request.accountStatus;
  }
  if (!Util.isUnset(request.accountType)) {
    query['accountType'] = request.accountType;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.username)) {
    query['username'] = request.username;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstanceAccount',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/accounts`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the accounts that are used to access a specific instance.
 *
 * @param request ListInstanceAccountRequest
 * @return ListInstanceAccountResponse
 */
async function listInstanceAccount(instanceId: string, request: ListInstanceAccountRequest): ListInstanceAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstanceAccountWithOptions(instanceId, request, headers, runtime);
}

model ListInstanceAclRequest {
  filter?: string(name='filter', description='The condition that you specify to filter the ACLs. If you do not specify this parameter, all ACLs are queried.', example='CID-TEST'),
  pageNumber?: int32(name='pageNumber', description='The page number. Pages start from page 1.', example='1'),
  pageSize?: int32(name='pageSize', description='The number of entries per page.', example='10'),
}

model ListInstanceAclResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied due to the reason that the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='MissingInstanceId'),
  data?: {
    list?: [ 
      {
        aclType?: string(name='aclType', description='The ACL type.

Valid value:

*   APACHE: open source ACL.', example='APACHE'),
        actions?: [ string ](name='actions', description='The types of the operations that are allowed by the ACL.'),
        decision?: string(name='decision', description='The decision result.

Valid values:

*   Deny: Access is denied.
*   Allow: Access is allowed.', example='Allow'),
        instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-7e22ody****'),
        ipWhitelists?: [ string ](name='ipWhitelists', description='The IP address whitelists.'),
        regionId?: string(name='regionId', description='The region ID.', example='cn-hangzhou'),
        resourceName?: string(name='resourceName', description='The resource name.', example='test'),
        resourceType?: string(name='resourceType', description='The resource type.

Valid values:

*   Group
*   Topic', example='Topic'),
        username?: string(name='username', description='The username.', example='test'),
      }
    ](name='list', description='The pagination information.'),
    pageNumber?: long(name='pageNumber', description='The page number.', example='1'),
    pageSize?: long(name='pageSize', description='The number of entries per page.', example='10'),
    totalCount?: long(name='totalCount', description='The total number of entries returned.', example='24'),
  }(name='data', description='The returned data.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='InstanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The request ID.', example='DA4D2F89-E2C8-5F04-936B-60D55B055FA7'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model ListInstanceAclResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstanceAclResponseBody(name='body'),
}

/**
 * @summary Queries the access control lists (ACLs) of an instance.
 *
 * @param request ListInstanceAclRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstanceAclResponse
 */
async function listInstanceAclWithOptions(instanceId: string, request: ListInstanceAclRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListInstanceAclResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.filter)) {
    query['filter'] = request.filter;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstanceAcl',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/acl`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the access control lists (ACLs) of an instance.
 *
 * @param request ListInstanceAclRequest
 * @return ListInstanceAclResponse
 */
async function listInstanceAcl(instanceId: string, request: ListInstanceAclRequest): ListInstanceAclResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstanceAclWithOptions(instanceId, request, headers, runtime);
}

model ListInstanceIpWhitelistRequest {
  ipWhitelist?: string(name='ipWhitelist', description='IP whitelist.', example='0.0.0.0/0'),
  pageNumber?: int32(name='pageNumber', description='The page number. Default value: 1.', example='1'),
  pageSize?: int32(name='pageSize', description='The number of entries to return on each page.', example='10'),
}

model ListInstanceIpWhitelistResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied because the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='Instance.NotFound'),
  data?: {
    list?: [ string ](name='list', description='The pagination information.'),
    pageNumber?: long(name='pageNumber', description='The page number.', example='1'),
    pageSize?: long(name='pageSize', description='Number of items per page.', example='10'),
    totalCount?: long(name='totalCount', description='The total number of returned entries.', example='5'),
  }(name='data', description='The data returned.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The ID of the request. Each request has a unique ID. You can use this ID to troubleshoot issues.', example='7358418D-83BD-507A-8079-611C63E05674'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model ListInstanceIpWhitelistResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstanceIpWhitelistResponseBody(name='body'),
}

/**
 * @summary Queries the IP address whitelists of an instance.
 *
 * @param request ListInstanceIpWhitelistRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstanceIpWhitelistResponse
 */
async function listInstanceIpWhitelistWithOptions(instanceId: string, request: ListInstanceIpWhitelistRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListInstanceIpWhitelistResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.ipWhitelist)) {
    query['ipWhitelist'] = request.ipWhitelist;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstanceIpWhitelist',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ip/whitelist`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the IP address whitelists of an instance.
 *
 * @param request ListInstanceIpWhitelistRequest
 * @return ListInstanceIpWhitelistResponse
 */
async function listInstanceIpWhitelist(instanceId: string, request: ListInstanceIpWhitelistRequest): ListInstanceIpWhitelistResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstanceIpWhitelistWithOptions(instanceId, request, headers, runtime);
}

model ListInstancesRequest {
  filter?: string(name='filter', description='The filter condition that is used to query instances. If you do not configure this parameter, all instances are queried.', example='rmq-cn-7e22ody****'),
  pageNumber?: int32(name='pageNumber', description='The page number.

Valid values: 1 to 100000000.

If you set this parameter to a value smaller than 1, the system uses 1 as the value. If you set this parameter to a value greater than 100000000, the system uses 100000000 as the value.', example='1'),
  pageSize?: int32(name='pageSize', description='The number of entries per page.

Value values: 10 to 200.

If you set this parameter to a value smaller than 10, the system uses 10 as the value. If you set this parameter to a value greater than 200, the system uses 200 as the value.', example='10'),
  resourceGroupId?: string(name='resourceGroupId', description='The ID of the resource group to which the instance belongs.', example='rg-acfmx7caj******'),
  seriesCodes?: [ string ](name='seriesCodes', description='The primary edition of the instance.

Valid values:

*   standard: Standard Edition
*   ultimate: Enterprise Platinum Edition
*   professional: Professional Edition'),
  storageSecretKey?: string(name='storageSecretKey', description='The storage encryption key.', example='xxxxx'),
  tags?: string(name='tags', description='The tags that are used to filter instances.', example='[{"key": "rmq-test", "value": "test"}]'),
}

model ListInstancesShrinkRequest {
  filter?: string(name='filter', description='The filter condition that is used to query instances. If you do not configure this parameter, all instances are queried.', example='rmq-cn-7e22ody****'),
  pageNumber?: int32(name='pageNumber', description='The page number.

Valid values: 1 to 100000000.

If you set this parameter to a value smaller than 1, the system uses 1 as the value. If you set this parameter to a value greater than 100000000, the system uses 100000000 as the value.', example='1'),
  pageSize?: int32(name='pageSize', description='The number of entries per page.

Value values: 10 to 200.

If you set this parameter to a value smaller than 10, the system uses 10 as the value. If you set this parameter to a value greater than 200, the system uses 200 as the value.', example='10'),
  resourceGroupId?: string(name='resourceGroupId', description='The ID of the resource group to which the instance belongs.', example='rg-acfmx7caj******'),
  seriesCodesShrink?: string(name='seriesCodes', description='The primary edition of the instance.

Valid values:

*   standard: Standard Edition
*   ultimate: Enterprise Platinum Edition
*   professional: Professional Edition'),
  storageSecretKey?: string(name='storageSecretKey', description='The storage encryption key.', example='xxxxx'),
  tags?: string(name='tags', description='The tags that are used to filter instances.', example='[{"key": "rmq-test", "value": "test"}]'),
}

model ListInstancesResponseBody = {
  code?: string(name='code', description='The error code returned if the call failed.', example='MissingPageNumber'),
  data?: {
    list?: [ 
      {
        commodityCode?: string(name='commodityCode', description='The commodity code of the instance. The commodity code of ApsaraMQ for RocketMQ 5.0 instances has a similar format to ons_rmqsub_public_cn.', example='ons_rmqsub_public_cn'),
        createTime?: string(name='createTime', description='The time when the version of the instance was updated.', example='2022-08-01 00:00:00'),
        expireTime?: string(name='expireTime', description='The time when the instance expires.', example='2022-09-01 00:00:00'),
        groupCount?: long(name='groupCount', description='The number of consumer groups that are created on the instance.', example='10'),
        instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-7e22ody****'),
        instanceName?: string(name='instanceName', description='The instance name.', example='test instance'),
        paymentType?: string(name='paymentType', description='The billing method of the instance.

Valid values:

*   PayAsYouGo
*   Subscription', example='Subscription'),
        productInfo?: {
          traceOn?: boolean(name='traceOn', description='Indicates whether the message trace feature is enabled. Valid values:

*   true
*   false

This parameter is not in use. By default, the message trace feature is enabled for ApsaraMQ for RocketMQ instances, regardless of whether this parameter is configured.', example='true'),
        }(name='productInfo', description='The product information.'),
        regionId?: string(name='regionId', description='The ID of the region in which the instance resides.', example='cn-hangzhou'),
        releaseTime?: string(name='releaseTime', description='The time when the instance was released.', example='2022-09-07 00:00:00'),
        remark?: string(name='remark', description='The instance description.', example='This is remark for instance.'),
        resourceGroupId?: string(name='resourceGroupId', description='The ID of the resource group to which the instance belongs.', example='rg-acfmx7caj******'),
        seriesCode?: string(name='seriesCode', description='The primary edition of the instance.

Valid values:

*   standard: Standard Edition
*   ultimate: Enterprise Platinum Edition
*   professional: Professional Edition', example='standard'),
        serviceCode?: string(name='serviceCode', description='The code of the service to which the instance belongs. The service code of ApsaraMQ for RocketMQ is rmq.', example='rmq'),
        startTime?: string(name='startTime', description='The time when the instance was created.', example='2022-08-01 00:00:00'),
        status?: string(name='status', description='The status of the instance.

Valid values:

*   RELEASED
*   RUNNING
*   STOPPED
*   CHANGING
*   CREATING', example='RUNNING'),
        subSeriesCode?: string(name='subSeriesCode', description='The sub-category edition of the instance.

Valid values:

*   cluster_ha: Cluster High-availability Edition
*   single_node: Standalone Edition', example='cluster_ha'),
        tags?: [ 
          {
            key?: string(name='key', description='The tag key of the resource.', example='key'),
            value?: string(name='value', description='The tag value of the resource.', example='value'),
          }
        ](name='tags', description='The resource tags.'),
        topicCount?: long(name='topicCount', description='The number of topics that are created on the instance.', example='20'),
        updateTime?: string(name='updateTime', description='The time when the instance was last modified.', example='2022-08-02 00:00:00'),
        userId?: string(name='userId', description='The ID of the user who owns the instance.', example='6W0xz2uPfiwp****'),
      }
    ](name='list', description='The pagination information.'),
    pageNumber?: long(name='pageNumber', description='The page number of the returned page.', example='1'),
    pageSize?: long(name='pageSize', description='The number of entries returned on each page.', example='10'),
    totalCount?: long(name='totalCount', description='The total number of returned entries.', example='100'),
  }(name='data', description='The data returned.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='PageNumber'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='pageNumber'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code returned.', example='400'),
  message?: string(name='message', description='The error message.', example='Parameter pageNumber is mandatory for this action .'),
  requestId?: string(name='requestId', description='The ID of the request. Each request has a unique ID. You can use this ID to troubleshoot issues.', example='84445A20-2B50-5306-A3C0-AF99FC1833C6'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model ListInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstancesResponseBody(name='body'),
}

/**
 * @summary Queries all ApsaraMQ for RocketMQ instances in a specific region.
 *
 * @description > API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
 *
 * @param tmpReq ListInstancesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstancesResponse
 */
async function listInstancesWithOptions(tmpReq: ListInstancesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListInstancesResponse {
  Util.validateModel(tmpReq);
  var request = new ListInstancesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.seriesCodes)) {
    request.seriesCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.seriesCodes, 'seriesCodes', 'simple');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.filter)) {
    query['filter'] = request.filter;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['resourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.seriesCodesShrink)) {
    query['seriesCodes'] = request.seriesCodesShrink;
  }
  if (!Util.isUnset(request.storageSecretKey)) {
    query['storageSecretKey'] = request.storageSecretKey;
  }
  if (!Util.isUnset(request.tags)) {
    query['tags'] = request.tags;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstances',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries all ApsaraMQ for RocketMQ instances in a specific region.
 *
 * @description > API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
 *
 * @param request ListInstancesRequest
 * @return ListInstancesResponse
 */
async function listInstances(request: ListInstancesRequest): ListInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstancesWithOptions(request, headers, runtime);
}

model ListMessagesRequest {
  endTime?: string(name='endTime', description='The end of the time range to query.', example='2024-09-09 09:00:00'),
  messageId?: string(name='messageId', description='Message Id.', example='7F00000100207A4F0F294A938F7807AE'),
  messageKey?: string(name='messageKey', description='Message key.', example='XSCBillResult'),
  pageNumber?: int32(name='pageNumber', description='The page number. Pages start from page 1.', example='1'),
  pageSize?: int32(name='pageSize', description='The number of entries per page.', example='10'),
  scrollId?: string(name='scrollId', description='The scroll ID of the request.

You do not need to configure this parameter for the first page. This parameter is included in the pagination request based on the result returned for the first page.', example='B13D0B07-F24B-4790-88D8-D47A38063D00'),
  startTime?: string(name='startTime', description='The beginning of the time range to query.', example='2024-09-09 08:00:00'),
}

model ListMessagesResponseBody = {
  code?: string(name='code', description='The error code.', example='MissingInstanceId'),
  data?: {
    list?: [ 
      {
        body?: string(name='body', description='Message body.', example='{}'),
        bodySize?: int32(name='bodySize', description='Message body size.', example='100'),
        bornHost?: string(name='bornHost', description='The client on which messages are produced.', example='xx.xx.xx.xx'),
        bornTime?: string(name='bornTime', description='Message born time.', example='2023-03-22 12:17:08'),
        instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-7e22ody****'),
        messageGroup?: string(name='messageGroup', description='The message group. This parameter is returned only for ordered messages.', example='xx'),
        messageId?: string(name='messageId', description='Message Id.', example='7F000001000114B4340C5ABF94500079'),
        messageKeys?: [ string ](name='messageKeys', description='Message keys.'),
        messageTag?: string(name='messageTag', description='The message tag.', example='xx'),
        messageType?: string(name='messageType', description='Message type.', example='NORMAL'),
        regionId?: string(name='regionId', description='The region ID.', example='cn-hangzhou'),
        storeHost?: string(name='storeHost', description='The broker on which messages are stored.', example='xx.xx.xx.xx'),
        storeTime?: string(name='storeTime', description='Message store time.', example='2023-03-22 12:17:08'),
        topicName?: string(name='topicName', description='The name of the topic.', example='topic_test'),
        userProperties?: map[string]string(name='userProperties', description='Message user properties.'),
      }
    ](name='list', description='The pagination information.'),
    pageNumber?: long(name='pageNumber', description='The page number.', example='1'),
    pageSize?: long(name='pageSize', description='The number of entries per page.', example='50'),
    scrollId?: string(name='scrollId', description='The scroll ID of the request.

The ID is automatically generated by the system. The result can be paginated only if this parameter is included in the pagination request.', example='B13D0B07-F24B-4790-88D8-D47A38063D00'),
    totalCount?: long(name='totalCount', description='The total number of returned entries.', example='0'),
  }(name='data', description='The data returned.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The ID of the request. Each request has a unique ID. You can use this ID to troubleshoot issues.', example='A3531B6A-5A88-52BD-B3C4-A024C3D0AA2E'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model ListMessagesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListMessagesResponseBody(name='body'),
}

/**
 * @summary Queries the list of messages.
 *
 * @param request ListMessagesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListMessagesResponse
 */
async function listMessagesWithOptions(instanceId: string, topicName: string, request: ListMessagesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListMessagesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.messageId)) {
    query['messageId'] = request.messageId;
  }
  if (!Util.isUnset(request.messageKey)) {
    query['messageKey'] = request.messageKey;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.scrollId)) {
    query['scrollId'] = request.scrollId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListMessages',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/topics/${OpenApiUtil.getEncodeParam(topicName)}/messages`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the list of messages.
 *
 * @param request ListMessagesRequest
 * @return ListMessagesResponse
 */
async function listMessages(instanceId: string, topicName: string, request: ListMessagesRequest): ListMessagesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listMessagesWithOptions(instanceId, topicName, request, headers, runtime);
}

model ListMetricMetaRequest {
  pageNumber?: int32(name='pageNumber', description='Page number, indicating which page of the results to return.

This parameter is required.', example='1'),
  pageSize?: int32(name='pageSize', description='Page size, indicating the maximum number of results per page.

This parameter is required.', example='10'),
}

model ListMetricMetaResponseBody = {
  code?: string(name='code', description='Error code', example='Topic.NotFound'),
  data?: {
    list?: [ 
      {
        category?: string(name='category', description='Monitoring item tag', example='Bug'),
        description?: string(name='description', description='Monitoring item description', example='Using Serverless Devs to deploy the infrastructure of project:get-userinfo-v1-infrastructure-as-template-project'),
        metricName?: string(name='metricName', description='Monitoring item name', example='SendMessageCountPerInstance'),
      }
    ](name='list', description='Paged data'),
    pageNumber?: long(name='pageNumber', description='Current page number', example='1'),
    pageSize?: long(name='pageSize', description='Page size', example='10'),
    totalCount?: long(name='totalCount', description='Total record count', example='1'),
  }(name='data', description='Return result'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code', example='xxx'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='xxx'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code', example='200'),
  message?: string(name='message', description='Error message', example='The topic already exists.'),
  requestId?: string(name='requestId', description='Request ID', example='8B459455-4A35-5796-BA9D-98EF1AB9A931'),
  success?: boolean(name='success', description='Whether the operation was successful', example='true'),
}

model ListMetricMetaResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListMetricMetaResponseBody(name='body'),
}

/**
 * @summary Query Monitoring Items List
 *
 * @param request ListMetricMetaRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListMetricMetaResponse
 */
async function listMetricMetaWithOptions(request: ListMetricMetaRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListMetricMetaResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListMetricMeta',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/monitor/metrics/meta`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Query Monitoring Items List
 *
 * @param request ListMetricMetaRequest
 * @return ListMetricMetaResponse
 */
async function listMetricMeta(request: ListMetricMetaRequest): ListMetricMetaResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listMetricMetaWithOptions(request, headers, runtime);
}

model ListRegionsResponseBody = {
  code?: string(name='code', description='The error code.', example='MissingPageNumber'),
  data?: [ 
    {
      createTime?: string(name='createTime', description='The time when the ApsaraMQ for RocketMQ instance was created.', example='2022-08-01 20:05:50'),
      regionId?: string(name='regionId', description='The region ID.', example='cn-hangzhou'),
      regionName?: string(name='regionName', description='The region name.', example='hangzhou'),
      supportRocketmqV4?: boolean(name='supportRocketmqV4', description='Indicates whether ApsaraMQ for RocketMQ V4 is activated.', example='true'),
      supportRocketmqV5?: boolean(name='supportRocketmqV5', description='Indicates whether ApsaraMQ for RocketMQ V5 is activated.', example='true'),
      tags?: [ 
        {
          tagCode?: string(name='tagCode', description='The tag code.', example='xx'),
          tagValue?: any(name='tagValue', description='The tag value.', example='xx'),
        }
      ](name='tags', description='The region tags.'),
      updateTime?: string(name='updateTime', description='The time when the ApsaraMQ for RocketMQ instance was last modified.', example='2022-08-01 20:05:50'),
    }
  ](name='data', description='The returned data.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='ConsumerGroupId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The request ID.', example='0B962390-D84B-5D44-8C11-79DF40299D41'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model ListRegionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListRegionsResponseBody(name='body'),
}

/**
 * @summary Queries regions in which ApsaraMQ for RocketMQ is available.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListRegionsResponse
 */
async function listRegionsWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): ListRegionsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListRegions',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/regions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries regions in which ApsaraMQ for RocketMQ is available.
 *
 * @return ListRegionsResponse
 */
async function listRegions(): ListRegionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listRegionsWithOptions(headers, runtime);
}

model ListTagResourcesRequest {
  nextToken?: string(name='nextToken', description='The position from which the next query starts.', example='d09e2b63e1b12d905b7080ff70'),
  regionId?: string(name='regionId', description='Region ID.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='resourceGroupId', description='Resource group ID.', example='rg-acfmx7caj******'),
  resourceId?: string(name='resourceId', description='List of resource IDs, in JSON format.', example='["rmq-cn-pe334n08h08"]'),
  resourceType?: string(name='resourceType', description='Resource type.

This parameter is required.', example='instance'),
  tag?: string(name='tag', description='List of tags, in JSON format.', example='[{"key": "rmq-test", "value": "test"}]'),
}

model ListTagResourcesResponseBody = {
  code?: string(name='code', description='Error code', example='Topic.NotFound'),
  data?: {
    nextToken?: string(name='nextToken', description='The position from which the next query starts.', example='d09e2b63e1b12d905b7080ff70'),
    requestId?: string(name='requestId', description='Request ID.', example='F00C6A70-C782-5DD6-9D11-0CFC710100C7'),
    tagResources?: [ 
      {
        aliUid?: long(name='aliUid', description='UID of the resource owner.', example='1876441048322426'),
        category?: string(name='category', description='Tag category.', example='custom'),
        resourceId?: string(name='resourceId', description='Resource ID.', example='rmq-cn-pe334n08h08'),
        resourceType?: string(name='resourceType', description='Resource type.', example='instance'),
        scope?: string(name='scope', description='Visibility scope.', example='public'),
        tagKey?: string(name='tagKey', description='Tag key.', example='key'),
        tagValue?: string(name='tagValue', description='Tag value.', example='value'),
      }
    ](name='tagResources', description='Resource tag relationships.'),
  }(name='data', description='Return result'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='Dynamic error message', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code', example='200'),
  message?: string(name='message', description='Error message', example='The topic already exists.'),
  requestId?: string(name='requestId', description='Request ID', example='F00C6A70-C782-5DD6-9D11-0CFC710100C7'),
  success?: boolean(name='success', description='Whether the operation was successful', example='true'),
}

model ListTagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagResourcesResponseBody(name='body'),
}

/**
 * @summary Query visible resource tag relationships
 *
 * @param request ListTagResourcesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagResourcesResponse
 */
async function listTagResourcesWithOptions(request: ListTagResourcesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTagResourcesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['regionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['resourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['resourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['resourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['tag'] = request.tag;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTagResources',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/resourceTag/list`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Query visible resource tag relationships
 *
 * @param request ListTagResourcesRequest
 * @return ListTagResourcesResponse
 */
async function listTagResources(request: ListTagResourcesRequest): ListTagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTagResourcesWithOptions(request, headers, runtime);
}

model ListTopicSubscriptionsResponseBody = {
  code?: string(name='code', description='The error code.', example='MissingInstanceId'),
  data?: [ 
    {
      consistency?: string(name='consistency', description='Indicates whether message consumption is consistent. Valid values:

*   false: Unconsumed messages exist in the consumer group.
*   true: No unconsumed message exists in the consumer group.', example='true'),
      consumerGroupId?: string(name='consumerGroupId', description='The consumer group ID.', example='CID-TEST'),
      filterExpression?: string(name='filterExpression', description='The filter expression.', example='*'),
      filterExpressionType?: string(name='filterExpressionType', description='The type of the filter expression. Valid values: SQL, TAG, and UNSPECIFIED. The value SQL indicates that messages are filtered by using SQL expressions. The value TAG indicates that messages are filtered by using tags. The value UNSPECIFIED indicates that no filter expression type is specified.', example='SQL'),
      messageModel?: string(name='messageModel', description='The consumption mode. Valid values: BROADCASTING and CLUSTERING.', example='BROADCASTING'),
      subscriptionStatus?: string(name='subscriptionStatus', description='The subscription status. Valid values: ONLINE and OFFLINE.', example='ONLINE'),
      topicName?: string(name='topicName', description='The topic name.', example='topic_test'),
    }
  ](name='data', description='The returned data.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='Topic'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The request ID.', example='92A9BE4E-B794-50C8-979C-0456E4D32943'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model ListTopicSubscriptionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTopicSubscriptionsResponseBody(name='body'),
}

/**
 * @summary Queries the subscriptions of a specific topic.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTopicSubscriptionsResponse
 */
async function listTopicSubscriptionsWithOptions(instanceId: string, topicName: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListTopicSubscriptionsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListTopicSubscriptions',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/topics/${OpenApiUtil.getEncodeParam(topicName)}/subscriptions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the subscriptions of a specific topic.
 *
 * @return ListTopicSubscriptionsResponse
 */
async function listTopicSubscriptions(instanceId: string, topicName: string): ListTopicSubscriptionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTopicSubscriptionsWithOptions(instanceId, topicName, headers, runtime);
}

model ListTopicsRequest {
  filter?: string(name='filter', description='The filter condition for the query. If not provided, all topics under the instance will be queried.', example='topic_test'),
  messageTypes?: [ string ](name='messageTypes', description='The message type of the topic.'),
  pageNumber?: int32(name='pageNumber', description='Page number, indicating which page of results to return.', example='1'),
  pageSize?: int32(name='pageSize', description='Page size, the maximum number of results to display per page.', example='3'),
}

model ListTopicsShrinkRequest {
  filter?: string(name='filter', description='The filter condition for the query. If not provided, all topics under the instance will be queried.', example='topic_test'),
  messageTypesShrink?: string(name='messageTypes', description='The message type of the topic.'),
  pageNumber?: int32(name='pageNumber', description='Page number, indicating which page of results to return.', example='1'),
  pageSize?: int32(name='pageSize', description='Page size, the maximum number of results to display per page.', example='3'),
}

model ListTopicsResponseBody = {
  code?: string(name='code', description='Error code.', example='Topic.NotFound'),
  data?: {
    list?: [ 
      {
        createTime?: string(name='createTime', description='Creation time.', example='2022-08-01 20:05:50'),
        instanceId?: string(name='instanceId', description='Instance ID.', example='rmq-cn-7e22ody****'),
        maxSendTps?: long(name='maxSendTps', description='The maximum TPS for message sending.', example='1000'),
        messageType?: string(name='messageType', description='The type of messages in the topic.

Valid values:

*   TRANSACTION: transactional messages
*   FIFO: ordered messages
*   DELAY: scheduled or delayed messages
*   NORMAL: normal messages', example='NORMAL'),
        regionId?: string(name='regionId', description='The region ID to which the instance belongs.', example='cn-hangzhou'),
        remark?: string(name='remark', description='Remark information of the topic.', example='This is the remark for test.'),
        status?: string(name='status', description='The topic status.

Valid values:

*   RUNNING
*   CREATING', example='RUNNING'),
        topicName?: string(name='topicName', description='Topic name.', example='topic_test'),
        updateTime?: string(name='updateTime', description='Last update time of the topic.', example='2022-08-01 20:05:50'),
      }
    ](name='list', description='The topics.'),
    pageNumber?: long(name='pageNumber', description='Current page number.', example='1'),
    pageSize?: long(name='pageSize', description='Page size.', example='3'),
    totalCount?: long(name='totalCount', description='Total number of results returned.', example='1'),
  }(name='data', description='The returned data.'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code.', example='TopicName'),
  dynamicMessage?: string(name='dynamicMessage', description='Dynamic error message.', example='topicName'),
  httpStatusCode?: int32(name='httpStatusCode', example='400'),
  message?: string(name='message', description='Error message.', example='The topic cannot be found.'),
  requestId?: string(name='requestId', description='Request ID, each request has a unique ID that can be used for troubleshooting and problem localization.', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Indicates whether the execution was successful.', example='true'),
}

model ListTopicsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTopicsResponseBody(name='body'),
}

/**
 * @summary Query Topic List
 *
 * @param tmpReq ListTopicsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTopicsResponse
 */
async function listTopicsWithOptions(instanceId: string, tmpReq: ListTopicsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTopicsResponse {
  Util.validateModel(tmpReq);
  var request = new ListTopicsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.messageTypes)) {
    request.messageTypesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.messageTypes, 'messageTypes', 'simple');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.filter)) {
    query['filter'] = request.filter;
  }
  if (!Util.isUnset(request.messageTypesShrink)) {
    query['messageTypes'] = request.messageTypesShrink;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTopics',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/topics`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Query Topic List
 *
 * @param request ListTopicsRequest
 * @return ListTopicsResponse
 */
async function listTopics(instanceId: string, request: ListTopicsRequest): ListTopicsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTopicsWithOptions(instanceId, request, headers, runtime);
}

model ListTracesRequest {
  endTime?: string(name='endTime', description='The end of the time range to query.

This parameter is required.', example='2023-05-19 10:10:09'),
  messageId?: string(name='messageId', description='The message ID.

This parameter is required if you set queryType to MESSAGE_ID.', example='0100163E0EC1F1965C04C7906700000000'),
  messageKey?: string(name='messageKey', description='The message key.

This parameter is required if you set queryType to MESSAGE_ID.', example='order_ceating'),
  pageNumber?: int32(name='pageNumber', description='The page number.

This parameter is required.', example='1'),
  pageSize?: int32(name='pageSize', description='The number of entries per page.

This parameter is required.', example='10'),
  queryType?: string(name='queryType', description='The query type.

Valid values:

*   MESSAGE_ID
*   MESSAGE_KEY
*   TOPIC

This parameter is required.', example='MESSAGE_ID'),
  startTime?: string(name='startTime', description='The beginning of the time range to query.

This parameter is required.', example='2023-05-10 10:42:11'),
}

model ListTracesResponseBody = {
  code?: string(name='code', description='The error code.', example='Topic.NotFound'),
  data?: {
    list?: [ 
      {
        bornTime?: string(name='bornTime', description='Message born time.', example='2023-03-22 12:17:08'),
        instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-7e22ody****'),
        messageId?: string(name='messageId', description='Message id.', example='7F00000100207A4F0F294A938F7807AE'),
        messageKeys?: [ string ](name='messageKeys', description='Message keys.'),
        messageTag?: string(name='messageTag', description='Message tag.', example='xx'),
        regionId?: string(name='regionId', description='The region ID.', example='cn-hangzhou'),
        topicName?: string(name='topicName', description='The name of the topic.', example='topic_test'),
      }
    ](name='list', description='Trace list.'),
    pageNumber?: long(name='pageNumber', description='The page number of the returned page.', example='1'),
    pageSize?: long(name='pageSize', description='The number of entries per page.', example='10'),
    totalCount?: long(name='totalCount', description='The total number of returned entries.', example='1'),
  }(name='data', description='The returned result.'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='InstanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='Id of the request', example='EDFF77E1-1ED1-5389-B6A8-651D9433BBE5'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model ListTracesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTracesResponseBody(name='body'),
}

/**
 * @summary Queries the message traces of a specific topic.
 *
 * @param request ListTracesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTracesResponse
 */
async function listTracesWithOptions(instanceId: string, topicName: string, request: ListTracesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTracesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.messageId)) {
    query['messageId'] = request.messageId;
  }
  if (!Util.isUnset(request.messageKey)) {
    query['messageKey'] = request.messageKey;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.queryType)) {
    query['queryType'] = request.queryType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTraces',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/topics/${OpenApiUtil.getEncodeParam(topicName)}/traces`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the message traces of a specific topic.
 *
 * @param request ListTracesRequest
 * @return ListTracesResponse
 */
async function listTraces(instanceId: string, topicName: string, request: ListTracesRequest): ListTracesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTracesWithOptions(instanceId, topicName, request, headers, runtime);
}

model ResetConsumeOffsetRequest {
  resetTime?: string(name='resetTime', description='The time when the consumer offset is reset.', example='2023-03-22 12:17:08'),
  resetType?: string(name='resetType', description='The method that is used to reset the consumer offset. Valid values: LATEST_OFFSET and SPECIFIED_TIME.', example='LATEST_OFFSET'),
}

model ResetConsumeOffsetResponseBody = {
  code?: string(name='code', description='The returned error code.', example='MissingInstanceId'),
  dynamicCode?: string(name='dynamicCode', description='The returned dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The returned dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The returned HTTP status code.', example='200'),
  message?: string(name='message', description='The returned error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The request ID.', example='F9A95891-EAD4-5A2B-8A30-676CD18921AF'),
  success?: boolean(name='success', description='Indicates whether the request is successful.', example='true'),
}

model ResetConsumeOffsetResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ResetConsumeOffsetResponseBody(name='body'),
}

/**
 * @summary Resets the consumer offset of a consumer group.
 *
 * @param request ResetConsumeOffsetRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ResetConsumeOffsetResponse
 */
async function resetConsumeOffsetWithOptions(instanceId: string, consumerGroupId: string, topicName: string, request: ResetConsumeOffsetRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ResetConsumeOffsetResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.resetTime)) {
    body['resetTime'] = request.resetTime;
  }
  if (!Util.isUnset(request.resetType)) {
    body['resetType'] = request.resetType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ResetConsumeOffset',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/consumerGroups/${OpenApiUtil.getEncodeParam(consumerGroupId)}/consumeOffsets/${OpenApiUtil.getEncodeParam(topicName)}`,
    method = 'PATCH',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Resets the consumer offset of a consumer group.
 *
 * @param request ResetConsumeOffsetRequest
 * @return ResetConsumeOffsetResponse
 */
async function resetConsumeOffset(instanceId: string, consumerGroupId: string, topicName: string, request: ResetConsumeOffsetRequest): ResetConsumeOffsetResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return resetConsumeOffsetWithOptions(instanceId, consumerGroupId, topicName, request, headers, runtime);
}

model StartDisasterRecoveryItemResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied due to the reason that the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='Error code', example='DisasterRecoveryItemStatus.Error'),
  data?: boolean(name='data', description='Return result', example='true'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='Dynamic error message', example='InstanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code', example='200'),
  message?: string(name='message', description='Error message', example='The current status of the disaster recovery item does not support this operation.'),
  requestId?: string(name='requestId', description='Request ID', example='C7E8AE3A-219B-52EE-BE32-4036Fxxxxx'),
  success?: boolean(name='success', description='Whether the operation was successful', example='true'),
}

model StartDisasterRecoveryItemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StartDisasterRecoveryItemResponseBody(name='body'),
}

/**
 * @summary Enable Disaster Recovery Plan Entry
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return StartDisasterRecoveryItemResponse
 */
async function startDisasterRecoveryItemWithOptions(planId: string, itemId: string, headers: map[string]string, runtime: Util.RuntimeOptions): StartDisasterRecoveryItemResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'StartDisasterRecoveryItem',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/disaster_recovery/${OpenApiUtil.getEncodeParam(planId)}/items/${OpenApiUtil.getEncodeParam(itemId)}/start`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Enable Disaster Recovery Plan Entry
 *
 * @return StartDisasterRecoveryItemResponse
 */
async function startDisasterRecoveryItem(planId: string, itemId: string): StartDisasterRecoveryItemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return startDisasterRecoveryItemWithOptions(planId, itemId, headers, runtime);
}

model StopDisasterRecoveryItemResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied because the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='Error code', example='DisasterRecoveryItemStatus.Error'),
  data?: boolean(name='data', description='Return result', example='true'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='Dynamic error message', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code', example='200'),
  message?: string(name='message', description='Error message', example='The current status of the disaster recovery item does not support this operation.'),
  requestId?: string(name='requestId', description='Request ID', example='A07B41BD-6DD3-5349-9E76-00303xxxx'),
  success?: boolean(name='success', description='Whether the operation was successful', example='true'),
}

model StopDisasterRecoveryItemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopDisasterRecoveryItemResponseBody(name='body'),
}

/**
 * @summary Deactivate Disaster Recovery Plan Entry
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return StopDisasterRecoveryItemResponse
 */
async function stopDisasterRecoveryItemWithOptions(planId: string, itemId: string, headers: map[string]string, runtime: Util.RuntimeOptions): StopDisasterRecoveryItemResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'StopDisasterRecoveryItem',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/disaster_recovery/${OpenApiUtil.getEncodeParam(planId)}/items/${OpenApiUtil.getEncodeParam(itemId)}/stop`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deactivate Disaster Recovery Plan Entry
 *
 * @return StopDisasterRecoveryItemResponse
 */
async function stopDisasterRecoveryItem(planId: string, itemId: string): StopDisasterRecoveryItemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return stopDisasterRecoveryItemWithOptions(planId, itemId, headers, runtime);
}

model SyncDisasterRecoveryCheckpointResponseBody = {
  code?: string(name='code', description='Error Code', example='Topic.NotFound'),
  data?: boolean(name='data', description='Result Data', example='true'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic Error Code', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP Status Code', example='400'),
  message?: string(name='message', description='Error Message', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='Request ID', example='7358418D-83BD-507A-8079-611C63E05674'),
  success?: boolean(name='success', description='Success or Not', example='true'),
}

model SyncDisasterRecoveryCheckpointResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SyncDisasterRecoveryCheckpointResponseBody(name='body'),
}

/**
 * @summary Synchronize Disaster Recovery Plan Consumption Progress
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SyncDisasterRecoveryCheckpointResponse
 */
async function syncDisasterRecoveryCheckpointWithOptions(planId: string, itemId: string, checkpointId: string, headers: map[string]string, runtime: Util.RuntimeOptions): SyncDisasterRecoveryCheckpointResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'SyncDisasterRecoveryCheckpoint',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/disaster_recovery/${OpenApiUtil.getEncodeParam(planId)}/items/${OpenApiUtil.getEncodeParam(itemId)}/checkpoints/${OpenApiUtil.getEncodeParam(checkpointId)}`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Synchronize Disaster Recovery Plan Consumption Progress
 *
 * @return SyncDisasterRecoveryCheckpointResponse
 */
async function syncDisasterRecoveryCheckpoint(planId: string, itemId: string, checkpointId: string): SyncDisasterRecoveryCheckpointResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return syncDisasterRecoveryCheckpointWithOptions(planId, itemId, checkpointId, headers, runtime);
}

model TagResourcesRequest {
  regionId?: string(name='regionId', description='The region ID.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: string(name='resourceId', description='The resource IDs, in the JSON format.

This parameter is required.', example='rmq-cn-pe3355cs707'),
  resourceType?: string(name='resourceType', description='The type of resource.

Set this parameter to **instance**. The value of this parameter cannot be changed.

This parameter is required.', example='instance'),
  tag?: string(name='tag', description='tag, in JSON format.

This parameter is required.', example='[{"key": "rmq-test", "value": "test"}]'),
}

model TagResourcesResponseBody = {
  code?: string(name='code', description='The error code.', example='Topic.NotFound'),
  data?: boolean(name='data', description='The returned result.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error code.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The request ID.', example='0B962390-D84B-5D44-8C11-79DF40299D41'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model TagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: TagResourcesResponseBody(name='body'),
}

/**
 * @summary Creates resource tags.
 *
 * @param request TagResourcesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return TagResourcesResponse
 */
async function tagResourcesWithOptions(request: TagResourcesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): TagResourcesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.regionId)) {
    query['regionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['resourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['resourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['tag'] = request.tag;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TagResources',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/resourceTag/create`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates resource tags.
 *
 * @param request TagResourcesRequest
 * @return TagResourcesResponse
 */
async function tagResources(request: TagResourcesRequest): TagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return tagResourcesWithOptions(request, headers, runtime);
}

model UntagResourcesRequest {
  all?: boolean(name='all', description='Whether to delete all tags.', example='true'),
  regionId?: string(name='regionId', description='The region ID.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: string(name='resourceId', description='The resource IDs, in the JSON format.

This parameter is required.', example='rmq-cn-pe3355cs707'),
  resourceType?: string(name='resourceType', description='The type of resource.

Set this parameter to **instance**. The value of this parameter cannot be changed.

This parameter is required.', example='instance'),
  tagKey?: string(name='tagKey', description='The keys of tags.', example='["key1", "key2"]'),
}

model UntagResourcesResponseBody = {
  code?: string(name='code', description='The error code.', example='Topic.NotFound'),
  data?: boolean(name='data', description='The returned data.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter deliveryOrderType is invalid.'),
  requestId?: string(name='requestId', description='The ID of the request. Each request has a unique ID. You can use this ID to troubleshoot issues.', example='A07B41BD-6DD3-5349-9E76-00303DF04BBE'),
  success?: boolean(name='success', description='Indicates whether the call was successful.', example='true'),
}

model UntagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UntagResourcesResponseBody(name='body'),
}

/**
 * @summary Removes tags from resources.
 *
 * @param request UntagResourcesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UntagResourcesResponse
 */
async function untagResourcesWithOptions(request: UntagResourcesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UntagResourcesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.all)) {
    query['all'] = request.all;
  }
  if (!Util.isUnset(request.regionId)) {
    query['regionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['resourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['resourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tagKey)) {
    query['tagKey'] = request.tagKey;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UntagResources',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/resourceTag/delete`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Removes tags from resources.
 *
 * @param request UntagResourcesRequest
 * @return UntagResourcesResponse
 */
async function untagResources(request: UntagResourcesRequest): UntagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return untagResourcesWithOptions(request, headers, runtime);
}

model UpdateConsumerGroupRequest {
  consumeRetryPolicy?: {
    deadLetterTargetTopic?: string(name='deadLetterTargetTopic', description='The dead-letter topic.

If a consumer still fails to consume a message after the maximum number of retries specified for the message is reached, the message is delivered to the dead-letter topic for subsequent business recovery or troubleshooting. For more information, see [Consumption retry and dead-letter messages](https://help.aliyun.com/document_detail/440356.html).', example='DLQ_mqtest'),
    maxRetryTimes?: int32(name='maxRetryTimes', description='The maximum number of retries.', example='16'),
    retryPolicy?: string(name='retryPolicy', description='The retry policy. For more information, see [Message retry](https://help.aliyun.com/document_detail/440356.html).

Valid values:

*   FixedRetryPolicy: fixed-interval retry. This value is valid only if you set deliveryOrderType to Orderly.
*   DefaultRetryPolicy: exponential backoff retry. This value is valid only if you set deliveryOrderType to Concurrently.

This parameter is required.', example='DefaultRetryPolicy'),
  }(name='consumeRetryPolicy', description='The new consumption retry policy of the consumer group. For more information, see [Consumption retry](https://help.aliyun.com/document_detail/440356.html).

This parameter is required.'),
  deliveryOrderType?: string(name='deliveryOrderType', description='The new message delivery method of the consumer group.

Valid values:

*   Concurrently: concurrent delivery
*   Orderly: ordered delivery

This parameter is required.', example='Concurrently'),
  maxReceiveTps?: long(name='maxReceiveTps', description='The maximum TPS for message sending.', example='100'),
  remark?: string(name='remark', description='The new description of the consumer group.', example='This is the remark for test.'),
}

model UpdateConsumerGroupResponseBody = {
  code?: string(name='code', description='Error code.', example='InvalidDeliveryOrderType'),
  data?: boolean(name='data', description='The result returned.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code.', example='xxx'),
  dynamicMessage?: string(name='dynamicMessage', description='Dynamic error message.', example='xxx'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code.', example='400'),
  message?: string(name='message', description='Error message.', example='Parameter deliveryOrderType is invalid.'),
  requestId?: string(name='requestId', description='The request ID, which is unique for each request and can be used for troubleshooting and problem localization.', example='C7F94090-3358-506A-97DC-34BC803C****'),
  success?: boolean(name='success', description='Indicates whether the execution was successful.', example='true'),
}

model UpdateConsumerGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateConsumerGroupResponseBody(name='body'),
}

/**
 * @summary Update ConsumerGroup
 *
 * @description >Notice: The OpenAPI provided by Alibaba Cloud is a management API used for managing and querying related resources of Alibaba Cloud services. It is recommended to integrate it only in the management chain. It is strictly prohibited to rely on OpenAPI implementation in the core data chain of message sending and receiving, otherwise it may lead to risks in the chain.
 *
 * @param request UpdateConsumerGroupRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateConsumerGroupResponse
 */
async function updateConsumerGroupWithOptions(instanceId: string, consumerGroupId: string, request: UpdateConsumerGroupRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateConsumerGroupResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.consumeRetryPolicy)) {
    body['consumeRetryPolicy'] = request.consumeRetryPolicy;
  }
  if (!Util.isUnset(request.deliveryOrderType)) {
    body['deliveryOrderType'] = request.deliveryOrderType;
  }
  if (!Util.isUnset(request.maxReceiveTps)) {
    body['maxReceiveTps'] = request.maxReceiveTps;
  }
  if (!Util.isUnset(request.remark)) {
    body['remark'] = request.remark;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateConsumerGroup',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/consumerGroups/${OpenApiUtil.getEncodeParam(consumerGroupId)}`,
    method = 'PATCH',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Update ConsumerGroup
 *
 * @description >Notice: The OpenAPI provided by Alibaba Cloud is a management API used for managing and querying related resources of Alibaba Cloud services. It is recommended to integrate it only in the management chain. It is strictly prohibited to rely on OpenAPI implementation in the core data chain of message sending and receiving, otherwise it may lead to risks in the chain.
 *
 * @param request UpdateConsumerGroupRequest
 * @return UpdateConsumerGroupResponse
 */
async function updateConsumerGroup(instanceId: string, consumerGroupId: string, request: UpdateConsumerGroupRequest): UpdateConsumerGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateConsumerGroupWithOptions(instanceId, consumerGroupId, request, headers, runtime);
}

model UpdateDisasterRecoveryItemRequest {
  topics?: [ 
    {
      consumerGroupId?: string(name='consumerGroupId', description='The ID of the consumer group. If you use the two-way backup mode, you must specify this parameter.', example='GID_xxx'),
      deliveryOrderType?: string(name='deliveryOrderType', description='The method used to deliver messages to the destination instance.

Valid values:

*   Concurrently: concurrent delivery
*   Orderly: ordered delivery', example='Concurrently'),
      instanceId?: string(name='instanceId', description='The instance ID. If you set instanceType to EXTERNAL_ROCKETMQ, the system automatically generates an ID for the instance. You can obtain the ID by querying the global message backup plan.', example='rmq-cn-em93y94xxx'),
      instanceType?: string(name='instanceType', description='The instance type. Valid values:

*   ALIYUN_ROCKETMQ: ApsaraMQ for RocketMQ instance
*   EXTERNAL_ROCKETMQ: open source RocketMQ cluster', example='ALIYUN_ROCKETMQ'),
      regionId?: string(name='regionId', description='The region ID.', example='cn-hangzhou'),
      topicName?: string(name='topicName', description='The topic name. You must specify this parameter.', example='Topic_xxx'),
    }
  ](name='topics', description='The topics involved in the topic mapping.'),
}

model UpdateDisasterRecoveryItemResponseBody = {
  code?: string(name='code', description='The error code.', example='Topic.NotFound'),
  data?: boolean(name='data', description='The returned data.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The response code.', example='200'),
  message?: string(name='message', description='The error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The request ID.', example='0C32BED2-FA9F-50AD-9DA7-8B70E26C9D0D'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model UpdateDisasterRecoveryItemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateDisasterRecoveryItemResponseBody(name='body'),
}

/**
 * @summary Updates a topic mapping in a global message backup plan.
 *
 * @param request UpdateDisasterRecoveryItemRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateDisasterRecoveryItemResponse
 */
async function updateDisasterRecoveryItemWithOptions(planId: string, itemId: string, request: UpdateDisasterRecoveryItemRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateDisasterRecoveryItemResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.topics)) {
    body['topics'] = request.topics;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateDisasterRecoveryItem',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/disaster_recovery/${OpenApiUtil.getEncodeParam(planId)}/items/${OpenApiUtil.getEncodeParam(itemId)}`,
    method = 'PATCH',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Updates a topic mapping in a global message backup plan.
 *
 * @param request UpdateDisasterRecoveryItemRequest
 * @return UpdateDisasterRecoveryItemResponse
 */
async function updateDisasterRecoveryItem(planId: string, itemId: string, request: UpdateDisasterRecoveryItemRequest): UpdateDisasterRecoveryItemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateDisasterRecoveryItemWithOptions(planId, itemId, request, headers, runtime);
}

model UpdateDisasterRecoveryPlanRequest {
  autoSyncCheckpoint?: boolean(name='autoSyncCheckpoint', description='Whether to enable automatic synchronization of consumption progress.

> This is effective only when consumption progress synchronization is enabled, i.e., the value of `syncCheckpointEnabled` is true.', example='true'),
  instances?: [ 
    {
      authType?: string(name='authType', description='The authentication type.

*   NO_AUTH: no authentication
*   ACL_AUTH: access control list (ACL)-based authentication', example='NO_AUTH'),
      endpointUrl?: string(name='endpointUrl', description='The instance endpoint. This parameter is required only if you set instanceType to EXTERNAL_ROCKETMQ.', example='xxx'),
      instanceId?: string(name='instanceId', description='The instance ID.', example='rmq-cn-83l3r0xxxx'),
      instanceRole?: string(name='instanceRole', description='The instance role. Valid values:

*   ACTIVE: primary instance
*   Passive: secondary instance', example='ACTIVE'),
      instanceType?: string(name='instanceType', description='The instance type. Valid values:

*   ALIYUN_ROCKETMQ: ApsaraMQ for RocketMQ instance
*   EXTERNAL_ROCKETMQ: open source RocketMQ cluster', example='ALIYUN_ROCKETMQ'),
      messageProperty?: {
        propertyKey?: string(name='propertyKey', description='The attribute key.', example='aaa'),
        propertyValue?: string(name='propertyValue', description='The attribute value.', example='bbb'),
      }(name='messageProperty', description='The message attribute. When you synchronize a message to the destination cluster, the system automatically adds the attribute to the message for SQL-based filtering.'),
      networkType?: string(name='networkType', description='The network type. This parameter is required only if you set instanceType to EXTERNAL_ROCKETMQ. Valid values:

*   TCP_INTERNET: Internet over TCP
*   TCP_VPC: virtual private cloud (VPC) over TCP.', example='TCP_INTERNET'),
      password?: string(name='password', description='The password that is used for authentication. This parameter is required only if you set authType to ACL_AUTH.', example='xxx'),
      regionId?: string(name='regionId', description='The region in which the instance resides.', example='cn-hangzhou'),
      securityGroupId?: string(name='securityGroupId', description='The ID of the security group to which the instance belongs. This parameter is required only if you set instanceType to EXTERNAL_ROCKETMQ.', example='sg-bp17hpmgz9******'),
      username?: string(name='username', description='The username that is used for authentication. This parameter is required only if you set authType to ACL_AUTH.', example='xxx'),
      vSwitchId?: string(name='vSwitchId', description='The ID of the vSwitch with which the instance is associated. If you want to specify multiple vSwitches, separate the vSwitches with vertical bars (|).', example='vsw-uf6gwtbn6etadpv******'),
      vpcId?: string(name='vpcId', description='The ID of the VPC with which the instance is associated. This parameter is required only if you set instanceType to EXTERNAL_ROCKETMQ.', example='vpc-wz9qt50xhtj9krb******'),
    }
  ](name='instances', description='The instances that are involved in the global message backup plan.'),
  planDesc?: string(name='planDesc', description='The description of the global message backup plan.', example='xxx'),
  planName?: string(name='planName', description='The name of the global message backup plan.', example='xxx'),
  planType?: string(name='planType', description='The type of the global message backup plan. Valid values:

*   ACTIVE_PASSIVE: geo-disaster recovery
*   ACTIVE_ACTIVE: active geo-redundancy', example='ACTIVE_PASSIVE'),
  syncCheckpointEnabled?: boolean(name='syncCheckpointEnabled', description='Switch for synchronizing consumption progress', example='true'),
}

model UpdateDisasterRecoveryPlanResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied because the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='DisasterRecoveryPlanStatus.Error'),
  data?: boolean(name='data', description='The data returned.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The response code.', example='200'),
  message?: string(name='message', description='The error message.', example='The current status of the disaster recovery plan does not support this operation.'),
  requestId?: string(name='requestId', description='The request ID.', example='A07B41BD-6DD3-5349-9E76-00303Dxxxx'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model UpdateDisasterRecoveryPlanResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateDisasterRecoveryPlanResponseBody(name='body'),
}

/**
 * @summary Modifies a global message backup plan.
 *
 * @param request UpdateDisasterRecoveryPlanRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateDisasterRecoveryPlanResponse
 */
async function updateDisasterRecoveryPlanWithOptions(planId: string, request: UpdateDisasterRecoveryPlanRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateDisasterRecoveryPlanResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.autoSyncCheckpoint)) {
    body['autoSyncCheckpoint'] = request.autoSyncCheckpoint;
  }
  if (!Util.isUnset(request.instances)) {
    body['instances'] = request.instances;
  }
  if (!Util.isUnset(request.planDesc)) {
    body['planDesc'] = request.planDesc;
  }
  if (!Util.isUnset(request.planName)) {
    body['planName'] = request.planName;
  }
  if (!Util.isUnset(request.planType)) {
    body['planType'] = request.planType;
  }
  if (!Util.isUnset(request.syncCheckpointEnabled)) {
    body['syncCheckpointEnabled'] = request.syncCheckpointEnabled;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateDisasterRecoveryPlan',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/disaster_recovery/${OpenApiUtil.getEncodeParam(planId)}`,
    method = 'PATCH',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifies a global message backup plan.
 *
 * @param request UpdateDisasterRecoveryPlanRequest
 * @return UpdateDisasterRecoveryPlanResponse
 */
async function updateDisasterRecoveryPlan(planId: string, request: UpdateDisasterRecoveryPlanRequest): UpdateDisasterRecoveryPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateDisasterRecoveryPlanWithOptions(planId, request, headers, runtime);
}

model UpdateInstanceRequest {
  aclInfo?: {
    aclTypes?: [ string ](name='aclTypes', description='The authentication type of the instance.'),
    defaultVpcAuthFree?: boolean(name='defaultVpcAuthFree', description='Indicates whether the authentication-free in VPCs feature is enabled.
Indicates whether the authentication-free in VPCs feature is enabled.
Valid values:
- true
- false', example='false'),
  }(name='aclInfo', description='The access control list for the instance.'),
  instanceName?: string(name='instanceName', description='The updated name of the instance.', example='test_instance'),
  networkInfo?: {
    internetInfo?: {
      ipWhitelist?: [ string ](name='ipWhitelist', description='The whitelist that includes the IP addresses that are allowed to access the ApsaraMQ for RocketMQ broker over the Internet.

*   If you do not configure an IP address whitelist, all CIDR blocks are allowed to access the ApsaraMQ for RocketMQ broker over the Internet.
*   If you configure an IP address whitelist, only the IP addresses in the whitelist are allowed to access the ApsaraMQ for RocketMQ broker over the Internet.'),
    }(name='internetInfo', description='The information about the Internet over which the instance is accessed. This parameter takes effect only if the Internet access feature is enabled for the instance.'),
  }(name='networkInfo', description='The updated network information about the instance.'),
  productInfo?: {
    autoScaling?: boolean(name='autoScaling', description='Specifies whether to enable the elastic transactions per second (TPS) feature for the instance.

Valid values:

*   true
*   false

After you enable the elastic TPS feature for an ApsaraMQ for RocketMQ instance, you can use a specific number of TPS that exceeds the specification limit. You are charged for using the elastic TPS feature. For more information, see [Computing fees](https://help.aliyun.com/document_detail/427237.html).

>  The elastic TPS feature is supported only by specific instance editions. For more information, see [Instance editions](https://help.aliyun.com/document_detail/444715.html).', example='true'),
    messageRetentionTime?: int32(name='messageRetentionTime', description='The retention period of messages. Unit: hours.

For information about the valid values of this parameter, see the "Limits on resource quotas" section of the [Limits](https://help.aliyun.com/document_detail/440347.html) topic.

ApsaraMQ for RocketMQ supports serverless scaling of message storage. You are charged storage fees based on your actual storage usage. You can change the retention period of messages to manage storage capacity. For more information, see [Storage fees](https://help.aliyun.com/document_detail/427238.html).', example='72'),
    sendReceiveRatio?: float(name='sendReceiveRatio', description='The ratio of the number of messages that you can send to the number of messages that you can receive on the instance.

Value values: 0.25 to 1.', example='0.5'),
    traceOn?: boolean(name='traceOn', description='Specifies whether to enable the message trace feature.

*   true
*   false

This parameter is not in use. By default, the message trace feature is enabled for ApsaraMQ for RocketMQ instances, regardless of whether this parameter is configured.', example='true'),
  }(name='productInfo', description='Additional configurations of the instance.'),
  remark?: string(name='remark', description='The updated description of the instance.', example='This is the remark for test.'),
}

model UpdateInstanceResponseBody = {
  code?: string(name='code', description='The error code.', example='MissingInstanceId'),
  data?: boolean(name='data', description='The result data that is returned.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='400'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The ID of the request. The system generates a unique ID for each request. You can troubleshoot issues based on the request ID.', example='AA87DE09-DA44-52F4-9515-78B1B607****'),
  success?: boolean(name='success', description='Indicates whether the call is successful.', example='true'),
}

model UpdateInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateInstanceResponseBody(name='body'),
}

/**
 * @summary Updates the basic information and specifications of an ApsaraMQ for RocketMQ instance.
 *
 * @description > API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
 *
 * @param request UpdateInstanceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateInstanceResponse
 */
async function updateInstanceWithOptions(instanceId: string, request: UpdateInstanceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.aclInfo)) {
    body['aclInfo'] = request.aclInfo;
  }
  if (!Util.isUnset(request.instanceName)) {
    body['instanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.networkInfo)) {
    body['networkInfo'] = request.networkInfo;
  }
  if (!Util.isUnset(request.productInfo)) {
    body['productInfo'] = request.productInfo;
  }
  if (!Util.isUnset(request.remark)) {
    body['remark'] = request.remark;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateInstance',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}`,
    method = 'PATCH',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Updates the basic information and specifications of an ApsaraMQ for RocketMQ instance.
 *
 * @description > API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
 *
 * @param request UpdateInstanceRequest
 * @return UpdateInstanceResponse
 */
async function updateInstance(instanceId: string, request: UpdateInstanceRequest): UpdateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateInstanceWithOptions(instanceId, request, headers, runtime);
}

model UpdateInstanceAccountRequest {
  accountStatus?: string(name='accountStatus', description='The status of the account.

Valid values:

*   DISABLE
*   ENABLE', example='ENABLE'),
  password?: string(name='password', description='The password of the account.', example='test'),
}

model UpdateInstanceAccountResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied because the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='Instance.NotFound'),
  data?: boolean(name='data', description='The returned result.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The ID of the request. Each request has a unique ID. You can use this ID to troubleshoot issues.', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Indicates whether the call is successful.', example='true'),
}

model UpdateInstanceAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateInstanceAccountResponseBody(name='body'),
}

/**
 * @summary Updates the information about a specific account in a specific instance.
 *
 * @param request UpdateInstanceAccountRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateInstanceAccountResponse
 */
async function updateInstanceAccountWithOptions(instanceId: string, username: string, request: UpdateInstanceAccountRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateInstanceAccountResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.accountStatus)) {
    query['accountStatus'] = request.accountStatus;
  }
  if (!Util.isUnset(request.password)) {
    query['password'] = request.password;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateInstanceAccount',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/accounts/${OpenApiUtil.getEncodeParam(username)}`,
    method = 'PATCH',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Updates the information about a specific account in a specific instance.
 *
 * @param request UpdateInstanceAccountRequest
 * @return UpdateInstanceAccountResponse
 */
async function updateInstanceAccount(instanceId: string, username: string, request: UpdateInstanceAccountRequest): UpdateInstanceAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateInstanceAccountWithOptions(instanceId, username, request, headers, runtime);
}

model UpdateInstanceAclRequest {
  actions?: [ string ](name='actions', description='The following items describe the types of permissions that can be granted based on the resource type:

*   Topic: Pub, Sub, and Pub|Sub
*   Consumer group: Sub

Valid values:

*   SUB: subscribe
*   Pub|Sub: publish and subscribe
*   Pub: publish', example='Pub'),
  decision?: string(name='decision', description='The decision result of the authorization.

Valid values:

*   Deny
*   Allow', example='Allow'),
  ipWhitelists?: [ string ](name='ipWhitelists', description='The IP address whitelists.'),
  resourceName?: string(name='resourceName', description='The name of the resource on which you want to grant permissions.

This parameter is required.', example='test'),
  resourceType?: string(name='resourceType', description='The type of the resource on which you want to grant permissions.

Valid values:

*   Group
*   Topic

This parameter is required.', example='Topic'),
}

model UpdateInstanceAclResponseBody = {
  accessDeniedDetail?: string(name='accessDeniedDetail', description='The details about the access denial. This parameter is returned only if the access is denied because the Resource Access Management (RAM) user does not have the required permissions.', example='xxx'),
  code?: string(name='code', description='The error code.', example='MissingInstanceId'),
  data?: boolean(name='data', description='The returned data.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The request ID.', example='C115601B-8736-5BBF-AC99-7FEAE1245A80'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model UpdateInstanceAclResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateInstanceAclResponseBody(name='body'),
}

/**
 * @summary Updates the permissions on the resources of a specific instance for a specific user.
 *
 * @param request UpdateInstanceAclRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateInstanceAclResponse
 */
async function updateInstanceAclWithOptions(instanceId: string, username: string, request: UpdateInstanceAclRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateInstanceAclResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.actions)) {
    body['actions'] = request.actions;
  }
  if (!Util.isUnset(request.decision)) {
    body['decision'] = request.decision;
  }
  if (!Util.isUnset(request.ipWhitelists)) {
    body['ipWhitelists'] = request.ipWhitelists;
  }
  if (!Util.isUnset(request.resourceName)) {
    body['resourceName'] = request.resourceName;
  }
  if (!Util.isUnset(request.resourceType)) {
    body['resourceType'] = request.resourceType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateInstanceAcl',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/acl/account/${OpenApiUtil.getEncodeParam(username)}`,
    method = 'PATCH',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Updates the permissions on the resources of a specific instance for a specific user.
 *
 * @param request UpdateInstanceAclRequest
 * @return UpdateInstanceAclResponse
 */
async function updateInstanceAcl(instanceId: string, username: string, request: UpdateInstanceAclRequest): UpdateInstanceAclResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateInstanceAclWithOptions(instanceId, username, request, headers, runtime);
}

model UpdateTopicRequest {
  maxSendTps?: long(name='maxSendTps', description='Maximum send message tps', example='500'),
  remark?: string(name='remark', description='Updated remarks for the topic.', example='This is the remark for test.'),
}

model UpdateTopicResponseBody = {
  code?: string(name='code', description='Error code.', example='Topic.NotFound'),
  data?: boolean(name='data', description='Return result.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='Dynamic error code', example='TopicName'),
  dynamicMessage?: string(name='dynamicMessage', description='动态错误信息', example='topicName'),
  httpStatusCode?: int32(name='httpStatusCode', description='HTTP status code.', example='400'),
  message?: string(name='message', description='Error message.', example='The topic cannot be found.'),
  requestId?: string(name='requestId', description='Request ID, each request has a unique ID that can be used for troubleshooting and problem localization.', example='AF9A8B10-C426-530F-A0DD-96320B39****'),
  success?: boolean(name='success', description='Whether the execution result is successful.', example='true'),
}

model UpdateTopicResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateTopicResponseBody(name='body'),
}

/**
 * @summary Update Topic
 *
 * @param request UpdateTopicRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateTopicResponse
 */
async function updateTopicWithOptions(instanceId: string, topicName: string, request: UpdateTopicRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateTopicResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.maxSendTps)) {
    body['maxSendTps'] = request.maxSendTps;
  }
  if (!Util.isUnset(request.remark)) {
    body['remark'] = request.remark;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateTopic',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/topics/${OpenApiUtil.getEncodeParam(topicName)}`,
    method = 'PATCH',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Update Topic
 *
 * @param request UpdateTopicRequest
 * @return UpdateTopicResponse
 */
async function updateTopic(instanceId: string, topicName: string, request: UpdateTopicRequest): UpdateTopicResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateTopicWithOptions(instanceId, topicName, request, headers, runtime);
}

model VerifyConsumeMessageRequest {
  clientId?: string(name='clientId', description='The client ID.

This parameter is required.', example='zeekr-settlement-server-dc555456f-v2lcg@1@1@qfvorazqns'),
  consumerGroupId?: string(name='consumerGroupId', description='The ID of the consumer group.

This parameter is required.', example='TEST_FINANCE_STOCK_OUT_GROUP'),
}

model VerifyConsumeMessageResponseBody = {
  code?: string(name='code', description='The error code.', example='Topic.NotFound'),
  data?: boolean(name='data', description='The returned data.', example='true'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='InstanceId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='instanceId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Parameter instanceId is mandatory for this action .'),
  requestId?: string(name='requestId', description='The request ID.', example='5304143F-AB0E-5AB4-A227-7C5489216FD5'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model VerifyConsumeMessageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: VerifyConsumeMessageResponseBody(name='body'),
}

/**
 * @summary Verifies the consumption status of a message in a specific topic on a specific instance.
 *
 * @param request VerifyConsumeMessageRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return VerifyConsumeMessageResponse
 */
async function verifyConsumeMessageWithOptions(instanceId: string, topicName: string, messageId: string, request: VerifyConsumeMessageRequest, headers: map[string]string, runtime: Util.RuntimeOptions): VerifyConsumeMessageResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.clientId)) {
    query['clientId'] = request.clientId;
  }
  if (!Util.isUnset(request.consumerGroupId)) {
    query['consumerGroupId'] = request.consumerGroupId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'VerifyConsumeMessage',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/topics/${OpenApiUtil.getEncodeParam(topicName)}/messages/${OpenApiUtil.getEncodeParam(messageId)}/action/verifyConsume`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Verifies the consumption status of a message in a specific topic on a specific instance.
 *
 * @param request VerifyConsumeMessageRequest
 * @return VerifyConsumeMessageResponse
 */
async function verifyConsumeMessage(instanceId: string, topicName: string, messageId: string, request: VerifyConsumeMessageRequest): VerifyConsumeMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return verifyConsumeMessageWithOptions(instanceId, topicName, messageId, request, headers, runtime);
}

model VerifySendMessageRequest {
  message?: string(name='message', description='The message body.', example='successful'),
  messageKey?: string(name='messageKey', description='The message key.', example='xx'),
  messageTag?: string(name='messageTag', description='The message tag.', example='xx'),
}

model VerifySendMessageResponseBody = {
  code?: string(name='code', description='The error code.', example='InvalidConsumerGroupId'),
  data?: string(name='data', description='The returned data.', example='0A64228900207A4F0F2931A4E0D40BE5'),
  dynamicCode?: string(name='dynamicCode', description='The dynamic error code.', example='ConsumerGroupId'),
  dynamicMessage?: string(name='dynamicMessage', description='The dynamic error message.', example='consumerGroupId'),
  httpStatusCode?: int32(name='httpStatusCode', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='The instance cannot be found.'),
  requestId?: string(name='requestId', description='The request ID.', example='3BD2C19B-66DE-59C7-B2F6-FD1BE21DC8C1'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model VerifySendMessageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: VerifySendMessageResponseBody(name='body'),
}

/**
 * @summary Verifies the message sending feature of a specific topic on a specific instance.
 *
 * @param request VerifySendMessageRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return VerifySendMessageResponse
 */
async function verifySendMessageWithOptions(instanceId: string, topicName: string, request: VerifySendMessageRequest, headers: map[string]string, runtime: Util.RuntimeOptions): VerifySendMessageResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.message)) {
    body['message'] = request.message;
  }
  if (!Util.isUnset(request.messageKey)) {
    body['messageKey'] = request.messageKey;
  }
  if (!Util.isUnset(request.messageTag)) {
    body['messageTag'] = request.messageTag;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'VerifySendMessage',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/instances/${OpenApiUtil.getEncodeParam(instanceId)}/topics/${OpenApiUtil.getEncodeParam(topicName)}/messages`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Verifies the message sending feature of a specific topic on a specific instance.
 *
 * @param request VerifySendMessageRequest
 * @return VerifySendMessageResponse
 */
async function verifySendMessage(instanceId: string, topicName: string, request: VerifySendMessageRequest): VerifySendMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return verifySendMessageWithOptions(instanceId, topicName, request, headers, runtime);
}

